OSDN Git Service

h264: do not print "too many references" warning for intra-only.
authorRonald S. Bultje <rsbultje@gmail.com>
Fri, 6 May 2011 20:31:26 +0000 (16:31 -0400)
committerRonald S. Bultje <rsbultje@gmail.com>
Tue, 10 May 2011 11:24:39 +0000 (07:24 -0400)
Fixes issue 2679.

libavcodec/h264_refs.c

index 13d43e6..a025f7d 100644 (file)
@@ -621,15 +621,17 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
         }
     }
 
-    if (h->long_ref_count + h->short_ref_count > h->sps.ref_frame_count){
+    if (h->long_ref_count + h->short_ref_count -
+            (h->short_ref[0] == s->current_picture_ptr) > h->sps.ref_frame_count){
 
         /* We have too many reference frames, probably due to corrupted
          * stream. Need to discard one frame. Prevents overrun of the
          * short_ref and long_ref buffers.
          */
         av_log(h->s.avctx, AV_LOG_ERROR,
-               "number of reference frames exceeds max (probably "
-               "corrupt input), discarding one\n");
+               "number of reference frames (%d+%d) exceeds max (%d; probably "
+               "corrupt input), discarding one\n",
+               h->long_ref_count, h->short_ref_count, h->sps.ref_frame_count);
 
         if (h->long_ref_count && !h->short_ref_count) {
             for (i = 0; i < 16; ++i)