mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-16 21:05:15 +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
1 changed files with 12 additions and 2 deletions
|
@ -243,8 +243,18 @@ where
|
|||
let wrap: T = from_glib_borrow(ptr as *mut InstanceStruct<T>);
|
||||
let imp = &*element.imp;
|
||||
|
||||
panic_to_error!(&wrap, &element.panicked, gst::StateChangeReturn::Failure, {
|
||||
imp.change_state(&wrap, from_glib(transition))
|
||||
// *Never* fail downwards state changes, this causes bugs in GStreamer
|
||||
// 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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue