Verify long_ref_count!=0. Fix issue 281.
authorPanagiotis Issaris <takis.issaris@uhasselt.be>
Wed, 5 Dec 2007 18:02:48 +0000 (18:02 +0000)
committerPanagiotis Issaris <takis.issaris@uhasselt.be>
Wed, 5 Dec 2007 18:02:48 +0000 (18:02 +0000)
Originally committed as revision 11171 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/h264.c

index 19d8319..298faa6 100644 (file)
@@ -3662,7 +3662,7 @@ static int decode_ref_pic_marking(H264Context *h, GetBitContext *gb){
         }else{
             assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count);
 
         }else{
             assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count);
 
-            if(h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count &&
+            if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count &&
                     !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) {
                 h->mmco[0].opcode= MMCO_SHORT2UNUSED;
                 h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num;
                     !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) {
                 h->mmco[0].opcode= MMCO_SHORT2UNUSED;
                 h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num;