]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/h264: in the absence of recovery points, be more tolerant on accepting plain...
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 4 Jun 2014 02:25:14 +0000 (04:25 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 4 Jun 2014 02:25:14 +0000 (04:25 +0200)
Fixes: Ticket3652
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_refs.c
libavcodec/h264_sei.c

index 942ba7f20a7f5a792960b7928170a1b2dfafc383..c46c372466d34c410876b149e7403e32540f017c 100644 (file)
@@ -1561,6 +1561,7 @@ again:
                 if(!idr_cleared)
                     idr(h); // FIXME ensure we don't lose some frames if there is reordering
                 idr_cleared = 1;
+                h->has_recovery_point = 1;
             case NAL_SLICE:
                 init_get_bits(&hx->gb, ptr, bit_length);
                 hx->intra_gb_ptr      =
index a25b5785a9105f271ecf533c91fb0aa8842eac04..c057c9709d49d583a39cc6b1bdd78367574c5013 100644 (file)
@@ -727,6 +727,8 @@ typedef struct H264Context {
 
     int frame_recovered;    ///< Initial frame has been completely recovered
 
+    int has_recovery_point;
+
     int luma_weight_flag[2];    ///< 7.4.3.2 luma_weight_lX_flag
     int chroma_weight_flag[2];  ///< 7.4.3.2 chroma_weight_lX_flag
 
index 9bb065d24d9e018ad95e0969bf3851cde49bfc2f..de1f60a41f5b0f55352194e7f1f34d3855fe0424 100644 (file)
@@ -775,7 +775,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count)
     if (   err >= 0
         && h->long_ref_count==0
         && (h->short_ref_count<=2 || h->pps.ref_count[0] <= 1 && h->pps.ref_count[1] <= 1 && pps_count == 1)
-        && h->pps.ref_count[0]<=2 + (h->picture_structure != PICT_FRAME)
+        && h->pps.ref_count[0]<=2 + (h->picture_structure != PICT_FRAME) + (2*!h->has_recovery_point)
         && h->cur_pic_ptr->f.pict_type == AV_PICTURE_TYPE_I){
         h->cur_pic_ptr->recovered |= 1;
         if(!h->avctx->has_b_frames)
index 4e2f981181fc7808bf799afb5eddef50425e8e02..88bf0f4977d069917fc668a793544b5137c815b2 100644 (file)
@@ -183,6 +183,8 @@ static int decode_recovery_point(H264Context *h)
     if (h->avctx->debug & FF_DEBUG_PICT_INFO)
         av_log(h->avctx, AV_LOG_DEBUG, "sei_recovery_frame_cnt: %d\n", h->sei_recovery_frame_cnt);
 
+    h->has_recovery_point = 1;
+
     return 0;
 }