From a7c75f8066cca47d9c0d5626f0a89ef731378239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 3 Dec 2022 19:56:46 +0200 Subject: [PATCH] fmp4mux: Crank clock for the first fragment in more tests Due to how aggregator works, it depends on how buffers are pulled whether aggregate() is called again or it is waiting for a timeout or EOS: works: - pad 1: 4 buffers, pad 2: 4 buffers - aggregate ready: take all 4/4 buffers - pad 1: 1 buffers, pad 2: 1 buffer - aggregate ready: take all 1/1 buffers waits: - pad 1: 5 buffers, pad 2: 4 buffers - aggregate ready: take all 5/4 buffers - pad 1: 0 buffers, pad 2: 1 buffer - aggregate not ready: waiting for timeout or EOS Also don't manually set the clock time as that's unnecessary. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/274 Part-of: --- mux/fmp4/tests/tests.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mux/fmp4/tests/tests.rs b/mux/fmp4/tests/tests.rs index 5e10754a..bb1b794d 100644 --- a/mux/fmp4/tests/tests.rs +++ b/mux/fmp4/tests/tests.rs @@ -77,6 +77,9 @@ fn test_buffer_flags_single_stream(cmaf: bool, set_dts: bool, caps: gst::Caps) { } } + // Crank the clock: this should bring us to the end of the first fragment + h.crank_single_clock_wait().unwrap(); + let header = h.pull().unwrap(); assert_eq!( header.flags(), @@ -312,6 +315,9 @@ fn test_buffer_flags_multi_stream() { } } + // Crank the clock: this should bring us to the end of the first fragment + h1.crank_single_clock_wait().unwrap(); + let header = h1.pull().unwrap(); assert_eq!( header.flags(), @@ -509,8 +515,7 @@ fn test_live_timeout() { } } - // Advance time and crank the clock: this should bring us to the end of the first fragment - h1.set_time(5.seconds()).unwrap(); + // Crank the clock: this should bring us to the end of the first fragment h1.crank_single_clock_wait().unwrap(); let header = h1.pull().unwrap(); @@ -728,8 +733,7 @@ fn test_gap_events() { } } - // Advance time and crank the clock: this should bring us to the end of the first fragment - h1.set_time(5.seconds()).unwrap(); + // Crank the clock: this should bring us to the end of the first fragment h1.crank_single_clock_wait().unwrap(); let header = h1.pull().unwrap(); @@ -1019,6 +1023,9 @@ fn test_single_stream_long_gops() { } } + // Crank the clock: this should bring us to the end of the first fragment + h.crank_single_clock_wait().unwrap(); + let header = h.pull().unwrap(); assert_eq!( header.flags(),