Merge commit 'e90a6846c2c006fbebd00e1f2789f4a86fafacef'
[ffmpeg.git] / libavcodec / cavsdec.c
index ec4a819..5e7c0ce 100644 (file)
@@ -948,6 +948,11 @@ static int decode_pic(AVSContext *h)
     int ret;
     enum cavs_mb mb_type;
 
+    if (!h->top_qp) {
+        av_log(h->avctx, AV_LOG_ERROR, "No sequence header decoded yet\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     av_frame_unref(h->cur.f);
 
     skip_bits(&h->gb, 16);//bbv_dwlay
@@ -1178,8 +1183,6 @@ static int cavs_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             *got_frame = 0;
             if (!h->got_keyframe)
                 break;
-            if(!h->top_qp)
-                break;
             init_get_bits(&h->gb, buf_ptr, input_size);
             h->stc = stc;
             if (decode_pic(h))