Release old pictures after a resolution change in vp5/6 decoder
authorLaurent Aimar <fenrir@videolan.org>
Wed, 21 Sep 2011 18:46:33 +0000 (20:46 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 6 Nov 2011 17:40:47 +0000 (18:40 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dba20b84784a7931b7eac50ced1d43e86801bde9)
(cherry picked from commit c9c6e5f4e8680b7b7801dd6943590ae9cd6bfd89)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/vp56.c

index ad11b52..65ddb8b 100644 (file)
@@ -519,6 +519,16 @@ int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
         if (!res)
             return -1;
 
+        if (res == 2) {
+            int i;
+            for (i = 0; i < 4; i++) {
+                if (s->frames[i].data[0])
+                    avctx->release_buffer(avctx, &s->frames[i]);
+            }
+            if (is_alpha)
+                return -1;
+        }
+
         if (!is_alpha) {
             p->reference = 1;
             if (avctx->get_buffer(avctx, p) < 0) {