mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-23 02:26:35 +00:00
onvifmetadataparse: Reset state in PAUSED->READY after pad deactivation
Otherwise the clock id will simply be overridden instead of unscheduling it, and if the streaming thread of the source pad currently waits on it then it will wait potentially for a very long time and deactivating the pad would wait for that to happen. Also unschedule the clock id on `Drop` of the state to be one the safe side and not simply forget about it. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1526>
This commit is contained in:
parent
70adedb142
commit
7757e06e36
1 changed files with 17 additions and 5 deletions
|
@ -153,6 +153,14 @@ impl Default for State {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for State {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
if let Some(clock_wait) = self.clock_wait.take() {
|
||||||
|
clock_wait.unschedule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct OnvifMetadataParse {
|
pub struct OnvifMetadataParse {
|
||||||
srcpad: gst::Pad,
|
srcpad: gst::Pad,
|
||||||
sinkpad: gst::Pad,
|
sinkpad: gst::Pad,
|
||||||
|
@ -1595,14 +1603,18 @@ impl ElementImpl for OnvifMetadataParse {
|
||||||
) -> Result<gst::StateChangeSuccess, gst::StateChangeError> {
|
) -> Result<gst::StateChangeSuccess, gst::StateChangeError> {
|
||||||
gst::trace!(CAT, imp: self, "Changing state {:?}", transition);
|
gst::trace!(CAT, imp: self, "Changing state {:?}", transition);
|
||||||
|
|
||||||
if matches!(
|
if matches!(transition, gst::StateChange::ReadyToPaused) {
|
||||||
transition,
|
|
||||||
gst::StateChange::PausedToReady | gst::StateChange::ReadyToPaused
|
|
||||||
) {
|
|
||||||
let mut state = self.state.lock().unwrap();
|
let mut state = self.state.lock().unwrap();
|
||||||
*state = State::default();
|
*state = State::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.parent_change_state(transition)
|
let res = self.parent_change_state(transition)?;
|
||||||
|
|
||||||
|
if matches!(transition, gst::StateChange::PausedToReady) {
|
||||||
|
let mut state = self.state.lock().unwrap();
|
||||||
|
*state = State::default();
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue