h264: set frame_num in start_frame(), not decode_slice_header()
authorAnton Khirnov <anton@khirnov.net>
Mon, 30 Nov 2015 21:52:36 +0000 (22:52 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sun, 6 Dec 2015 08:43:45 +0000 (09:43 +0100)
That is a more appropriate place for it, since it is not allowed to
change between slices.

libavcodec/h264_slice.c

index 4c82588..4f2d6a8 100644 (file)
@@ -553,6 +553,7 @@ static int h264_frame_start(H264Context *h)
     pic->reference              = h->droppable ? 0 : h->picture_structure;
     pic->f->coded_picture_number = h->coded_picture_number++;
     pic->field_picture          = h->picture_structure != PICT_FRAME;
+    pic->frame_num               = h->frame_num;
     /*
      * Zero key_frame here; IDR markings per slice in frame or fields are ORed
      * in later.
@@ -1418,9 +1419,6 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
         }
     }
 
-    if (!h->setup_finished)
-        h->cur_pic_ptr->frame_num = h->frame_num; // FIXME frame_num cleanup
-
     assert(h->mb_num == h->mb_width * h->mb_height);
     if (first_mb_in_slice << FIELD_OR_MBAFF_PICTURE(h) >= h->mb_num ||
         first_mb_in_slice >= h->mb_num) {