ffmpeg | branch: master | Daniel Glöckner <daniel...@gmx.net> | Sun Aug 6 03:04:53 2017 +0200| [feb1dbc7bd4c395400c48055c563ac23d5251716] | committer: Michael Niedermayer
avformat/mov: prevent duplication of first fragment's ctts_data MP4 files with fragments might have the first moof box that is mentioned in a fragment index before the first mdat box. Since it is then already parsed by mov_read_header, we have to make sure that mov_switch_root will not parse it again when seeking by setting the headers_read flag in the index. Parsing it a second time would cause the ctts_data array to receive a second copy of the information from the trun box, leading to wrong PTS values for the second and following fragments in presence of B-frames. Fixes ticket 6560. Signed-off-by: Daniel Glöckner <daniel...@gmx.net> Reviewed-by: Dale Curtis <dalecur...@chromium.org> Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=feb1dbc7bd4c395400c48055c563ac23d5251716 --- libavformat/mov.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 89b2af7597..994e9c6eba 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6363,6 +6363,13 @@ static int mov_read_header(AVFormatContext *s) } ff_configure_buffers_for_index(s, AV_TIME_BASE); + for (i = 0; i < mov->fragment_index_count; i++) { + MOVFragmentIndex *idx = mov->fragment_index_data[i]; + for (j = 0; j < idx->item_count; j++) + if (idx->items[j].moof_offset <= mov->fragment.moof_offset) + idx->items[j].headers_read = 1; + } + return 0; } _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog