[FFmpeg-cvslog] h261dec: Fix order of initialization

John Stebbins git at videolan.org
Fri Aug 15 03:10:14 CEST 2014


ffmpeg | branch: master | John Stebbins <stebbins at jetheaddev.com> | Fri Aug  8 08:55:48 2014 -0700| [552bc42df48784ae3ce0d499ece5b33f3cc7576a] | committer: John Stebbins

h261dec: Fix order of initialization

ff_MPV_common_init requires the frame dimensions which get parsed in
h261_decode_picture_header.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=552bc42df48784ae3ce0d499ece5b33f3cc7576a
---

 libavcodec/h261dec.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 88ca63d..6b358a6 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -581,12 +581,9 @@ static int h261_decode_frame(AVCodecContext *avctx, void *data,
 retry:
     init_get_bits(&s->gb, buf, buf_size * 8);
 
-    if (!s->context_initialized) {
+    if (!s->context_initialized)
         // we need the IDCT permutaton for reading a custom matrix
         ff_mpv_idct_init(s);
-        if (ff_MPV_common_init(s) < 0)
-            return -1;
-    }
 
     ret = h261_decode_picture_header(h);
 
@@ -602,6 +599,11 @@ retry:
         ff_MPV_common_end(s);
         s->parse_context = pc;
     }
+
+    if (!s->context_initialized)
+        if ((ret = ff_MPV_common_init(s)) < 0)
+            return ret;
+
     if (!s->context_initialized) {
         ret = ff_set_dimensions(avctx, s->width, s->height);
         if (ret < 0)



More information about the ffmpeg-cvslog mailing list