diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-10-18 16:30:08 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-10-19 13:25:21 +0200 |
commit | dfe7e5501d4acf007f66f7ad8606499f7d7dc2cb (patch) | |
tree | f709d459e32724e48bfbe0a06c2b0247552ee621 | |
parent | 18ad44d14548a54e0e7926c97ab15d3daafaf771 (diff) | |
download | ffmpeg-dfe7e5501d4acf007f66f7ad8606499f7d7dc2cb.tar.gz |
FATE: Add test for muxing discontinuous MP4 fragments with large timestamps
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r-- | libavformat/tests/movenc.c | 39 | ||||
-rw-r--r-- | tests/ref/fate/movenc | 5 |
2 files changed, 35 insertions, 9 deletions
diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c index 41cd4fcdf7..ab871765d9 100644 --- a/libavformat/tests/movenc.c +++ b/libavformat/tests/movenc.c @@ -243,7 +243,7 @@ static void init(int bf, int audio_preroll) init_fps(bf, audio_preroll, 30); } -static void mux_frames(int n) +static void mux_frames(int n, int c) { int end_frames = frames + n; while (1) { @@ -299,6 +299,12 @@ static void mux_frames(int n) continue; if (skip_write_audio && pkt.stream_index == 1) continue; + + if (c) { + pkt.pts += (1LL<<32); + pkt.dts += (1LL<<32); + } + if (do_interleave) av_interleaved_write_frame(ctx, &pkt); else @@ -308,7 +314,7 @@ static void mux_frames(int n) static void mux_gops(int n) { - mux_frames(gop_size * n); + mux_frames(gop_size * n, 0); } static void skip_gops(int n) @@ -665,6 +671,21 @@ int main(int argc, char **argv) finish(); + // Test muxing discontinuous fragments with very large (> (1<<31)) timestamps. + av_dict_set(&opts, "movflags", "frag_custom+delay_moov+dash+frag_discont", 0); + av_dict_set(&opts, "fragment_index", "2", 0); + init(1, 1); + signal_init_ts(); + skip_gops(1); + mux_frames(gop_size, 1); // Write the second fragment + init_out("delay-moov-elst-signal-init-discont-largets"); + av_write_frame(ctx, NULL); // Output the moov + close_out(); + init_out("delay-moov-elst-signal-second-frag-discont-largets"); + av_write_frame(ctx, NULL); // Output the second fragment + close_out(); + finish(); + // Test VFR content, with sidx atoms (which declare the pts duration // of a fragment, forcing overriding the start pts of the next one). // Here, the fragment duration in pts is significantly different from @@ -680,9 +701,9 @@ int main(int argc, char **argv) init_out("vfr"); av_dict_set(&opts, "movflags", "frag_keyframe+delay_moov+dash", 0); init_fps(1, 1, 3); - mux_frames(gop_size/2); + mux_frames(gop_size/2, 0); duration /= 10; - mux_frames(gop_size/2); + mux_frames(gop_size/2, 0); mux_gops(1); finish(); close_out(); @@ -699,9 +720,9 @@ int main(int argc, char **argv) init_out("vfr-noduration"); av_dict_set(&opts, "movflags", "frag_keyframe+delay_moov+dash", 0); init_fps(1, 1, 3); - mux_frames(gop_size/2); + mux_frames(gop_size/2, 0); duration /= 10; - mux_frames(gop_size/2); + mux_frames(gop_size/2, 0); mux_gops(1); finish(); close_out(); @@ -729,16 +750,16 @@ int main(int argc, char **argv) av_dict_set(&opts, "movflags", "frag_keyframe+delay_moov", 0); av_dict_set(&opts, "frag_duration", "650000", 0); init_fps(1, 1, 30); - mux_frames(gop_size/2); + mux_frames(gop_size/2, 0); // Pretend that the packet duration is the normal, even if // we actually skip a bunch of frames. (I.e., simulate that // we don't know of the framedrop in advance.) fake_pkt_duration = duration; duration *= 10; - mux_frames(1); + mux_frames(1, 0); fake_pkt_duration = 0; duration /= 10; - mux_frames(gop_size/2 - 1); + mux_frames(gop_size/2 - 1, 0); mux_gops(1); finish(); close_out(); diff --git a/tests/ref/fate/movenc b/tests/ref/fate/movenc index d3a86bc65c..09e603aeb7 100644 --- a/tests/ref/fate/movenc +++ b/tests/ref/fate/movenc @@ -108,6 +108,11 @@ c3681590a292cb9ca19a5a982e530166 1219 delay-moov-elst-signal-init-discont write_data len 996, time 966667, type sync atom sidx aa5462cc0d2144f72154d9c309edb57d 996 delay-moov-elst-signal-second-frag-discont write_data len 110, time nopts, type trailer atom - +write_data len 1243, time nopts, type header atom ftyp +dac14c8795d5cbd91ae770c6e2880c62 1243 delay-moov-elst-signal-init-discont-largets +write_data len 996, time 279621233333, type sync atom sidx +41cac4c3df656a87bb38363fdcd745e6 996 delay-moov-elst-signal-second-frag-discont-largets +write_data len 110, time nopts, type trailer atom - write_data len 1219, time nopts, type header atom ftyp write_data len 2572, time -333333, type sync atom sidx write_data len 996, time 5166667, type sync atom sidx |