aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2015-11-18 16:41:04 +0000
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2015-11-18 16:43:32 +0000
commitbdcf2b6af64b64d7c83339f75d7a909ed50c6562 (patch)
tree6ccae1acd3e981e0688d30bc113a8743850b45f0
parent3e0daf0716888d166329cffa554893846d6ec3be (diff)
parent1d62ee38894afb696674db78cee8f8d89204a8fe (diff)
downloadffmpeg-bdcf2b6af64b64d7c83339f75d7a909ed50c6562.tar.gz
Merge commit '1d62ee38894afb696674db78cee8f8d89204a8fe'
* commit '1d62ee38894afb696674db78cee8f8d89204a8fe': movenc: Add a unit test for signaling of the track start times Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r--libavformat/movenc-test.c51
-rw-r--r--tests/ref/fate/movenc4
2 files changed, 55 insertions, 0 deletions
diff --git a/libavformat/movenc-test.c b/libavformat/movenc-test.c
index d9c7a1a005..a274a5ec4c 100644
--- a/libavformat/movenc-test.c
+++ b/libavformat/movenc-test.c
@@ -280,6 +280,23 @@ static void skip_gops(int n)
skip_write = 0;
}
+static void signal_init_ts(void)
+{
+ AVPacket pkt;
+ av_init_packet(&pkt);
+ pkt.size = 0;
+ pkt.data = NULL;
+
+ pkt.stream_index = 0;
+ pkt.dts = video_dts;
+ pkt.pts = 0;
+ av_write_frame(ctx, &pkt);
+
+ pkt.stream_index = 1;
+ pkt.dts = pkt.pts = audio_dts;
+ av_write_frame(ctx, &pkt);
+}
+
static void finish(void)
{
av_write_trailer(ctx);
@@ -576,6 +593,40 @@ int main(int argc, char **argv)
finish();
+ // Test discontinously written fragments with b-frames and audio preroll,
+ // properly signaled.
+ av_dict_set(&opts, "movflags", "frag_custom+delay_moov+dash", 0);
+ init(1, 1);
+ mux_gops(1);
+ init_out("delay-moov-elst-signal-init");
+ av_write_frame(ctx, NULL); // Output the moov
+ close_out();
+ memcpy(header, hash, HASH_SIZE);
+ av_write_frame(ctx, NULL); // Output the first fragment
+ init_out("delay-moov-elst-signal-second-frag");
+ mux_gops(1);
+ av_write_frame(ctx, NULL); // Output the second fragment
+ close_out();
+ memcpy(content, hash, HASH_SIZE);
+ finish();
+
+ 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_gops(1); // Write the second fragment
+ init_out("delay-moov-elst-signal-init-discont");
+ av_write_frame(ctx, NULL); // Output the moov
+ close_out();
+ check(!memcmp(hash, header, HASH_SIZE), "discontinuously written header differs");
+ init_out("delay-moov-elst-signal-second-frag-discont");
+ av_write_frame(ctx, NULL); // Output the second fragment
+ close_out();
+ check(!memcmp(hash, content, HASH_SIZE), "discontinuously written fragment differs");
+ 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
diff --git a/tests/ref/fate/movenc b/tests/ref/fate/movenc
index 3e7fe34984..abb728f5f4 100644
--- a/tests/ref/fate/movenc
+++ b/tests/ref/fate/movenc
@@ -20,5 +20,9 @@ a0165f4a26a409212b0946e981bdefb9 1584 delay-moov-content
fcae8f40e015b59aabc8d4a99a759ca1 996 delay-moov-elst-second-frag
6256445b9595de78be493e0faf2bc5d7 1219 delay-moov-elst-init-discont
fcae8f40e015b59aabc8d4a99a759ca1 996 delay-moov-elst-second-frag-discont
+29f875e401df0fc3026995d12872ef21 1219 delay-moov-elst-signal-init
+aa5462cc0d2144f72154d9c309edb57d 996 delay-moov-elst-signal-second-frag
+29f875e401df0fc3026995d12872ef21 1219 delay-moov-elst-signal-init-discont
+aa5462cc0d2144f72154d9c309edb57d 996 delay-moov-elst-signal-second-frag-discont
6cd6085f4f0ff536acfcb77cb658eb47 4935 vfr
6cd6085f4f0ff536acfcb77cb658eb47 4935 vfr-noduration