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>
Wed, 21 Sep 2011 23:19:21 +0000 (01:19 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dba20b84784a7931b7eac50ced1d43e86801bde9)

libavcodec/vp56.c

index cf89176..25ec7a3 100644 (file)
@@ -513,6 +513,16 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
         if (!res)
             return -1;
 
         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) {
         if (!is_alpha) {
             p->reference = 1;
             if (avctx->get_buffer(avctx, p) < 0) {