[FFmpeg-cvslog] avutil/buffer: Avoid moving the AVBufferRef to a new place in memory in av_buffer_realloc ()

Michael Niedermayer git at videolan.org
Thu Mar 12 03:06:13 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Jan 15 00:42:55 2015 +0100| [35fad1e9c90b329b8680787ee5a00c74223c6029] | committer: Michael Niedermayer

avutil/buffer: Avoid moving the AVBufferRef to a new place in memory in av_buffer_realloc()

This allows reallocating AVBufferRefs without the need to update
all pointers to it

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35fad1e9c90b329b8680787ee5a00c74223c6029
---

 libavutil/buffer.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index ca102fd..b31f034 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -201,8 +201,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size)
 
         memcpy(new->data, buf->data, FFMIN(size, buf->size));
 
-        av_buffer_unref(pbuf);
-        *pbuf = new;
+        buffer_replace(pbuf, &new);
         return 0;
     }
 



More information about the ffmpeg-cvslog mailing list