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 /libavformat/tests | |
parent | 18ad44d14548a54e0e7926c97ab15d3daafaf771 (diff) | |
download | ffmpeg-streaming-dfe7e5501d4acf007f66f7ad8606499f7d7dc2cb.zip ffmpeg-streaming-dfe7e5501d4acf007f66f7ad8606499f7d7dc2cb.tar.gz |
FATE: Add test for muxing discontinuous MP4 fragments with large timestamps
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavformat/tests')
-rw-r--r-- | libavformat/tests/movenc.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c index 41cd4fc..ab87176 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(); |