utils/fallbacksrc: Don't error out if we just reached 100% buffering when the timeout triggered

It will take a moment for the fallbackswitch to actually switch to the
main stream. So instead take into account the time since the last
buffering update even when we reached 100%, and don't reset that time
when reaching 100%.
This commit is contained in:
Sebastian Dröge 2020-05-20 12:44:28 +03:00
parent ba161a146d
commit 621907556d

View file

@ -1486,7 +1486,6 @@ impl FallbackSrc {
drop(state_guard);
element.notify("status");
} else {
state.last_buffering_update = None;
// Check if we can unblock now
self.unblock_pads(element, state);
@ -1781,11 +1780,10 @@ impl FallbackSrc {
gst_warning!(CAT, obj: element, "Switched to fallback stream");
// If we're not actively buffering right now let's restart the source
if state.buffering_percent == 100
|| state
if state
.last_buffering_update
.map(|i| i.elapsed() >= Duration::from_nanos(state.settings.timeout))
.unwrap_or(true)
.unwrap_or(state.buffering_percent == 100)
{
gst_debug!(CAT, obj: element, "Not buffering, restarting source");
self.handle_source_error(element, state);