|
|
@ -170,6 +170,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AVBufferRef *buf = *pbuf; |
|
|
|
AVBufferRef *buf = *pbuf; |
|
|
|
uint8_t *tmp; |
|
|
|
uint8_t *tmp; |
|
|
|
|
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
|
|
if (!buf) { |
|
|
|
if (!buf) { |
|
|
|
/* allocate a new buffer with av_realloc(), so it will be reallocatable
|
|
|
|
/* allocate a new buffer with av_realloc(), so it will be reallocatable
|
|
|
@ -196,9 +197,9 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) |
|
|
|
/* cannot realloc, allocate a new reallocable buffer and copy data */ |
|
|
|
/* cannot realloc, allocate a new reallocable buffer and copy data */ |
|
|
|
AVBufferRef *new = NULL; |
|
|
|
AVBufferRef *new = NULL; |
|
|
|
|
|
|
|
|
|
|
|
av_buffer_realloc(&new, size); |
|
|
|
ret = av_buffer_realloc(&new, size); |
|
|
|
if (!new) |
|
|
|
if (ret < 0) |
|
|
|
return AVERROR(ENOMEM); |
|
|
|
return ret; |
|
|
|
|
|
|
|
|
|
|
|
memcpy(new->data, buf->data, FFMIN(size, buf->size)); |
|
|
|
memcpy(new->data, buf->data, FFMIN(size, buf->size)); |
|
|
|
|
|
|
|
|
|
|
|