avcodec/h264_slice: Only call ff_h264_flush_change() on initialized contexts
authorJames Almer <jamrial@gmail.com>
Fri, 1 Jul 2016 18:59:41 +0000 (20:59 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 1 Jul 2016 19:39:09 +0000 (21:39 +0200)
Changed by committer to ensure context_initialized is reset
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/h264_slice.c

index 427554c..ca492ba 100644 (file)
@@ -1415,6 +1415,7 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
     }
 
     if (!h->context_initialized || must_reinit || needs_reinit) {
+        int flush_changes = h->context_initialized;
         h->context_initialized = 0;
         if (sl != h->slice_ctx) {
             av_log(h->avctx, AV_LOG_ERROR,
@@ -1428,7 +1429,8 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
 
         av_assert1(first_slice);
 
-        ff_h264_flush_change(h);
+        if(flush_changes)
+            ff_h264_flush_change(h);
 
         if ((ret = get_pixel_format(h, 1)) < 0)
             return ret;