Signed-off-by: Decai Lin <decai....@intel.com> --- libavcodec/h264_slice.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 1c9a270..1bc9bdb 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1477,6 +1477,11 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, /* Shorten frame num gaps so we don't have to allocate reference * frames just to throw them away */ if (h->poc.frame_num != h->poc.prev_frame_num) { + /* In case for some error clips the IDR frame_num is not-zero, set the + * prev_frame_num = frame_num -1; otherwise will generate frame num gap. */ + if (nal->type == H264_NAL_IDR_SLICE && h->poc.frame_num != 0) + h->poc.prev_frame_num = h->poc.frame_num - 1; + int unwrap_prev_frame_num = h->poc.prev_frame_num; int max_frame_num = 1 << sps->log2_max_frame_num; -- 1.8.3.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".