fallbackswitch: Fix racy manual switching test

The element has a small race condition where it might output two buffers
with the same running time during e.g. a manual switch. In practice this
is not a problem, so the test takes this race into account.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/195
This commit is contained in:
Vivia Nikolaidou 2022-04-18 16:11:25 +03:00
parent b423febfbe
commit 385a983e5f

View file

@ -461,7 +461,7 @@ fn test_manual_switch(live: bool) {
push_buffer(&pipeline, gst::ClockTime::SECOND);
set_time(&pipeline, gst::ClockTime::SECOND + LATENCY);
let mut buffer = pull_buffer(&pipeline);
// FIXME: Sometimes we get the ZERO buffer from the fallback sink instead
// FIXME: Sometimes we first get the ZERO buffer from the fallback sink
if buffer.pts() == Some(gst::ClockTime::ZERO) {
buffer = pull_buffer(&pipeline);
}
@ -471,7 +471,11 @@ fn test_manual_switch(live: bool) {
push_buffer(&pipeline, 2 * gst::ClockTime::SECOND);
push_fallback_buffer(&pipeline, 2 * gst::ClockTime::SECOND);
set_time(&pipeline, 2 * gst::ClockTime::SECOND + LATENCY);
let buffer = pull_buffer(&pipeline);
buffer = pull_buffer(&pipeline);
// FIXME: Sometimes we first get the 1sec buffer from the main sink
if buffer.pts() == Some(gst::ClockTime::SECOND) {
buffer = pull_buffer(&pipeline);
}
assert_buffer!(buffer, Some(2 * gst::ClockTime::SECOND));
drop(mainsink);