mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-02 11:52:31 +00:00
Never fail downwards state changes
This causes bugs in GStreamer and leads to crashes and deadlocks
This commit is contained in:
parent
083371866a
commit
ac09ae7d73
|
@ -243,8 +243,18 @@ where
|
||||||
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
|
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
|
||||||
let imp = &*element.imp;
|
let imp = &*element.imp;
|
||||||
|
|
||||||
panic_to_error!(&wrap, &element.panicked, gst::StateChangeReturn::Failure, {
|
// *Never* fail downwards state changes, this causes bugs in GStreamer
|
||||||
imp.change_state(&wrap, from_glib(transition))
|
// and leads to crashes and deadlocks.
|
||||||
|
let transition = from_glib(transition);
|
||||||
|
let fallback = match transition {
|
||||||
|
gst::StateChange::PlayingToPaused
|
||||||
|
| gst::StateChange::PausedToReady
|
||||||
|
| gst::StateChange::ReadyToNull => gst::StateChangeReturn::Success,
|
||||||
|
_ => gst::StateChangeReturn::Failure,
|
||||||
|
};
|
||||||
|
|
||||||
|
panic_to_error!(&wrap, &element.panicked, fallback, {
|
||||||
|
imp.change_state(&wrap, transition)
|
||||||
}).to_glib()
|
}).to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue