mpegvideo: unref buffers in ff_mpeg_unref_picture on frame size changes
authorJanne Grunau <janne-libav@jannau.net>
Tue, 21 May 2013 15:39:27 +0000 (17:39 +0200)
committerJanne Grunau <janne-libav@jannau.net>
Wed, 22 May 2013 13:40:12 +0000 (15:40 +0200)
ff_mpeg_unref_picture clears the flag indicating that the frame needs to
be reallocated after a frame size change. Since we have now reference
counted buffers we can unref the buffers immediately.

libavcodec/mpegvideo.c

index b175d32..c9a425a 100644 (file)
@@ -435,6 +435,9 @@ void ff_mpeg_unref_picture(MpegEncContext *s, Picture *pic)
 
     av_buffer_unref(&pic->hwaccel_priv_buf);
 
+    if (pic->needs_realloc)
+        free_picture_tables(pic);
+
     memset((uint8_t*)pic + off, 0, sizeof(*pic) - off);
 }