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

Michael Niedermayer michaelni at gmx.at
Thu Jan 15 01:04:55 CET 2015


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

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 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;
     }
 
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list