ffmpeg/tests/ref/seek
Dale Curtis 37e8edc9f5 avformat/mov: Fix trampling of ctts during seeks when sidx support is enabled.
When sidx box support is enabled, the code will skip reading all
trun boxes (each containing ctts entries for samples inthat box).

If seeks are attempted before all ctts values are known, the old
code would dump ctts entries into the wrong location. These are
then used to compute pts values which leads to out of order and
incorrectly timestamped packets.

This patch fixes ctts processing by always using the index returned
by av_add_index_entry() as the ctts_data index. When the index gains
new entries old values are reshuffled as appropriate.

This approach makes sense since the mov demuxer is already relying
on the mapping of AVIndex entries to samples for correct demuxing.

As a result of this all ctts entries are now 1-count. A followup
change will be submitted to remove support for > 1 count entries
which will simplify seeking.

Notes for future improvement:
Probably there are other boxes (stts, stsc, etc) that are impacted
by this issue... this patch only attempts to fix ctts since it
completely breaks packet timestamping.

This patch continues using an array for the ctts data, which is not
the most ideal given the rearrangement that needs to happen (via
memmove as new entries are read in). Ideally AVIndex and the ctts
data would be set-type structures so addition is always worst case
O(lg(n)) instead of the O(n^2) that exists now; this slowdown is
noticeable during seeks.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-08-24 11:02:22 +02:00
..
acodec-adpcm-ima_qt fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-adpcm-ima_qt-trellis fate: enable fate-seek-acodec-adpcm-ima_qt-trellis 2014-06-06 18:03:31 +02:00
acodec-adpcm-ima_wav fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-adpcm-ima_wav-trellis tests: add adpcm trellis tests 2014-06-05 12:20:49 +02:00
acodec-adpcm-ms fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-adpcm-ms-trellis tests: add adpcm trellis tests 2014-06-05 12:20:49 +02:00
acodec-adpcm-swf lavf/flvdec: init AVPacket::pos to FLVTAG offset 2016-10-26 02:12:18 +02:00
acodec-adpcm-swf-trellis lavf/flvdec: init AVPacket::pos to FLVTAG offset 2016-10-26 02:12:18 +02:00
acodec-adpcm-yamaha fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-adpcm-yamaha-trellis tests: add adpcm trellis tests 2014-06-05 12:20:49 +02:00
acodec-alac fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-flac fate: update seeking reference for flac 2014-04-14 17:43:25 +02:00
acodec-mp2 avformat/mp3dec: use the common mechanism for skipping samples 2015-04-22 14:16:35 +02:00
acodec-pcm-alaw fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-f32be Merge commit 'e816034a5f' 2012-12-03 02:33:27 +01:00
acodec-pcm-f32le fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-f64be Merge commit 'e816034a5f' 2012-12-03 02:33:27 +01:00
acodec-pcm-f64le fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-mulaw fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-s8 fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-s16be fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-s16le ff_put_wav_header: add flag to force WAVEFORMATEX 2014-04-30 16:41:35 +02:00
acodec-pcm-s24be fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-s24le fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-s32be fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-s32le fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
acodec-pcm-u8 ff_put_wav_header: add flag to force WAVEFORMATEX 2014-04-30 16:41:35 +02:00
cache-pipe ffmpeg, ffprobe: don't "merge" side data into packet data by default 2017-03-14 23:37:28 +01:00
extra-mp3 ffmpeg, ffprobe: don't "merge" side data into packet data by default 2017-03-14 23:37:28 +01:00
extra-mp4 avformat/mov: Fix trampling of ctts during seeks when sidx support is enabled. 2017-08-24 11:02:22 +02:00
lavf-aiff fate: update seek-lavf-aiff after previous commit 2013-01-03 20:03:43 +00:00
lavf-alaw ffmpeg: remove obsolete workaround in trim insertion. 2013-08-07 16:20:41 +02:00
lavf-asf lavf: Replace the ASF demuxer 2015-06-28 10:16:40 +02:00
lavf-au avformat/au: Write MetaData in AU Sun audio file header 2016-06-03 12:18:57 +02:00
lavf-avi avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
lavf-bmp fate: upate after 55d32eed8f 2013-01-08 18:47:09 +00:00
lavf-dv_fmt Merge commit 'e816034a5f' 2012-12-03 02:33:27 +01:00
lavf-ffm Remove avserver. 2014-06-18 14:55:28 +02:00
lavf-flv_fmt lavf/flvdec: init AVPacket::pos to FLVTAG offset 2016-10-26 02:12:18 +02:00
lavf-gif Cleanse GIF muxer and encoder. 2013-04-18 00:24:25 +02:00
lavf-gxf avcodec/mpeg12enc: store sequence display extension only if we have something to store in it 2014-06-06 22:54:22 +02:00
lavf-jpg mjpegenc: enable optimal huffman coding by default 2017-04-09 00:00:39 +01:00
lavf-mkv avformat/matroskaenc: write a DisplayUnit element when aspect ratio is unknown 2016-10-15 20:48:03 -03:00
lavf-mmf 10l: Update fate seeking reference after last commit. 2013-01-05 23:42:00 +01:00
lavf-mov avformat/movenc: only ommit encoder tag of the metadata for bitexact mode 2014-03-16 16:26:35 +01:00
lavf-mpg lavf: introduce AVFMT_TS_NEGATIVE 2013-04-25 10:13:27 +02:00
lavf-mulaw ffmpeg: remove obsolete workaround in trim insertion. 2013-08-07 16:20:41 +02:00
lavf-mxf avformat/mxfenc: Only store user comment related tags when needed 2015-11-10 23:27:51 +01:00
lavf-mxf_d10 mxf: Set audio packets pts 2014-03-06 19:28:20 +01:00
lavf-mxf_opatom libavformat/mxfenc: add container duration and package name to primer pack 2015-03-23 22:09:46 +01:00
lavf-mxf_opatom_audio avformat/mxfenc: Only store user comment related tags when needed 2015-11-10 23:27:51 +01:00
lavf-nut nutenc: do not use has_b_frames 2015-01-27 09:15:07 +01:00
lavf-ogg ffmpeg: prefix encoder with "Lavc " in bitexact mode 2014-05-18 22:57:20 +02:00
lavf-pbmpipe lavf/img2dec: add pnm pipe demuxers 2016-06-22 15:24:19 +02:00
lavf-pcx fate: upate after 55d32eed8f 2013-01-08 18:47:09 +00:00
lavf-pgm fate: upate after 55d32eed8f 2013-01-08 18:47:09 +00:00
lavf-pgmpipe lavf/img2dec: add pnm pipe demuxers 2016-06-22 15:24:19 +02:00
lavf-ppm fate: upate after 55d32eed8f 2013-01-08 18:47:09 +00:00
lavf-ppmpipe lavf/img2dec: add pnm pipe demuxers 2016-06-22 15:24:19 +02:00
lavf-rm Merge commit 'e816034a5f' 2012-12-03 02:33:27 +01:00
lavf-sgi Merge commit '99f40fd02f' 2015-11-29 15:42:33 +01:00
lavf-swf fate: split dependencies for fate-seek tests 2012-12-02 23:25:41 +01:00
lavf-tga fate: upate after 55d32eed8f 2013-01-08 18:47:09 +00:00
lavf-tiff fate: upate after 55d32eed8f 2013-01-08 18:47:09 +00:00
lavf-ts ffmpeg, ffprobe: don't "merge" side data into packet data by default 2017-03-14 23:37:28 +01:00
lavf-voc Merge commit '9200514ad8' 2016-04-10 20:59:55 +01:00
lavf-wav ff_put_wav_header: add flag to force WAVEFORMATEX 2014-04-30 16:41:35 +02:00
lavf-wtv avcodec/mpeg12enc: store sequence display extension only if we have something to store in it 2014-06-06 22:54:22 +02:00
lavf-yuv4mpeg avformat/yuv4mpegdec: fix seeking for partial files 2016-03-03 09:28:15 +01:00
mkv-codec-delay ffmpeg, ffprobe: don't "merge" side data into packet data by default 2017-03-14 23:37:28 +01:00
vsynth_lena-asv1 avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-asv2 avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-dnxhd-4k-hr-lb tests/fate: add dnxhr encoding tests 2016-07-24 12:31:07 +02:00
vsynth_lena-dnxhd-720p tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-dnxhd-720p-rd tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-dnxhd-1080i tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-dv tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-dv-50 tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-dv-411 tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-ffv1 avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-flashsv lavf/flvdec: init AVPacket::pos to FLVTAG offset 2016-10-26 02:12:18 +02:00
vsynth_lena-flv lavf/flvdec: init AVPacket::pos to FLVTAG offset 2016-10-26 02:12:18 +02:00
vsynth_lena-h261 avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-h263 avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-h263p avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-huffyuv avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-jpegls avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-ljpeg avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-mjpeg mjpegenc: enable optimal huffman coding by default 2017-04-09 00:00:39 +01:00
vsynth_lena-mpeg1 tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-mpeg1b tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-mpeg2-422 tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-mpeg2-idct-int tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-mpeg2-ilace tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-mpeg2-ivlc-qprd tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-mpeg2-thread tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-mpeg2-thread-ivlc tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-mpeg4 tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-mpeg4-adap avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-mpeg4-adv avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-mpeg4-error avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-mpeg4-nr avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-mpeg4-nsse avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-mpeg4-qpel avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-mpeg4-qprd avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-mpeg4-rc avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-mpeg4-thread avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-msmpeg4 avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-msmpeg4v2 avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-rgb avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-roqvideo tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-rv10 tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-rv20 tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-snow avcodec/snowenc: set dia_size for the first pass of motion estimation too 2015-05-10 14:19:56 +02:00
vsynth_lena-snow-ll avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-svq1 tests: Rename vsynth2 to vsynth_lena 2014-12-02 03:02:30 +01:00
vsynth_lena-wmv1 avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-wmv2 avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00
vsynth_lena-yuv avformat/avienc: Fix wrongly placed comment 2015-03-19 17:30:28 +01:00