changeset 9821:0813b30e7db9 libavcodec

Get new buffer during frame decoding in VB video decoder, not only once during decoder initialization.
author kostya
date Sat, 06 Jun 2009 08:46:08 +0000
parents b72fbafc9408
children 2887f410011f
files vb.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/vb.c	Sat Jun 06 05:38:09 2009 +0000
+++ b/vb.c	Sat Jun 06 08:46:08 2009 +0000
@@ -185,6 +185,14 @@
     int rest = buf_size;
     int offset = 0;
 
+    if(c->pic.data[0])
+        avctx->release_buffer(avctx, &c->pic);
+    c->pic.reference = 1;
+    if(avctx->get_buffer(avctx, &c->pic) < 0){
+        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+        return -1;
+    }
+
     c->stream = buf;
     flags = bytestream_get_le16(&c->stream);
     rest -= 2;
@@ -247,12 +255,6 @@
         return -1;
     }
 
-    c->pic.reference = 1;
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
     c->frame      = av_malloc( avctx->width * avctx->height);
     c->prev_frame = av_malloc( avctx->width * avctx->height);