Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sdroege/gst-plugin-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2023-11-08 19:45:51 +0300
committerSebastian Dröge <sebastian@centricular.com>2023-12-18 11:00:15 +0300
commit4fd3b287e8bff884d78b07170b6d5244e43932da (patch)
tree0156212428ff0f0b3d24ae7571c7c4a544da1db2 /utils
parent2274c62db7ac1e13f460d663d3c906a817be8b3b (diff)
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/1410>
Diffstat (limited to 'utils')
-rw-r--r--utils/fallbackswitch/src/fallbacksrc/imp.rs27
1 files changed, 15 insertions, 12 deletions
diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs
index 9b4a7c17..f1e51e13 100644
--- a/utils/fallbackswitch/src/fallbacksrc/imp.rs
+++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs
@@ -3206,20 +3206,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,
- );
}
});
})