Merge commit 'b869eea7ea8f5d8331fcd6355f848bb6a6e06b14'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 15 Aug 2014 00:27:03 +0000 (02:27 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 15 Aug 2014 00:28:49 +0000 (02:28 +0200)
* commit 'b869eea7ea8f5d8331fcd6355f848bb6a6e06b14':
  h263dec: Fix order of initialization

Merged-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/h263dec.c

index 74e4be4..40d9814 100644 (file)
@@ -456,21 +456,9 @@ retry:
     if (ret < 0)
         return ret;
 
-    if (!s->context_initialized) {
+    if (!s->context_initialized)
         // we need the idct permutaton for reading a custom matrix
         ff_mpv_idct_init(s);
-        if ((ret = ff_MPV_common_init(s)) < 0)
-            return ret;
-    }
-
-    /* We need to set current_picture_ptr before reading the header,
-     * otherwise we cannot store anyting in there */
-    if (s->current_picture_ptr == NULL || s->current_picture_ptr->f->data[0]) {
-        int i = ff_find_unused_picture(s, 0);
-        if (i < 0)
-            return i;
-        s->current_picture_ptr = &s->picture[i];
-    }
 
     /* let's go :-) */
     if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
@@ -510,6 +498,17 @@ retry:
         return ret;
     }
 
+    if (!s->context_initialized)
+        if ((ret = ff_MPV_common_init(s)) < 0)
+            return ret;
+
+    if (s->current_picture_ptr == NULL || s->current_picture_ptr->f->data[0]) {
+        int i = ff_find_unused_picture(s, 0);
+        if (i < 0)
+            return i;
+        s->current_picture_ptr = &s->picture[i];
+    }
+
     avctx->has_b_frames = !s->low_delay;
 
     if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {