mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-23 01:18:11 +00:00
fallbacksrc: Fix timeout scheduling
Other thread can schedule the timeout (e.g., unblock signal or active pad change) while state lock is released Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1411>
This commit is contained in:
parent
2136befbef
commit
55d2b9483c
1 changed files with 15 additions and 12 deletions
|
@ -3214,20 +3214,23 @@ impl FallbackSrc {
|
|||
} else {
|
||||
let mut state_guard = imp.state.lock();
|
||||
let state = state_guard.as_mut().expect("no state");
|
||||
if fallback_source {
|
||||
assert!(state
|
||||
.fallback_source
|
||||
.as_ref()
|
||||
.map(|s| s.restart_timeout.is_none())
|
||||
.unwrap_or(true));
|
||||
let source = if fallback_source {
|
||||
if let Some(source) = &state.fallback_source {
|
||||
source
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
assert!(state.source.restart_timeout.is_none());
|
||||
&state.source
|
||||
};
|
||||
|
||||
if source.restart_timeout.is_none() {
|
||||
imp.schedule_source_restart_timeout(
|
||||
state,
|
||||
gst::ClockTime::ZERO,
|
||||
fallback_source,
|
||||
);
|
||||
}
|
||||
imp.schedule_source_restart_timeout(
|
||||
state,
|
||||
gst::ClockTime::ZERO,
|
||||
fallback_source,
|
||||
);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue