mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 19:41:09 +00:00
gst-utils: prevent dead lock when requesting key unit
Sending the UpstreamForceKeyUnitEvent using gst_element_send_event() internally takes the state lock. If appsink is pre-rolling we are also holding the preroll lock. This may result in a dead lock with the thread doing the state change as this one takes the state lock and then the pre-roll lock. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1316>
This commit is contained in:
parent
d7494bf1db
commit
7bde0285ff
1 changed files with 3 additions and 1 deletions
|
@ -320,7 +320,9 @@ impl StreamProducer {
|
||||||
drop(consumers);
|
drop(consumers);
|
||||||
|
|
||||||
if needs_keyframe_request {
|
if needs_keyframe_request {
|
||||||
appsink.send_event(
|
// Do not use `gst_element_send_event()` as it takes the state lock which may lead to dead locks.
|
||||||
|
let pad = appsink.static_pad("sink").unwrap();
|
||||||
|
pad.push_event(
|
||||||
gst_video::UpstreamForceKeyUnitEvent::builder()
|
gst_video::UpstreamForceKeyUnitEvent::builder()
|
||||||
.all_headers(true)
|
.all_headers(true)
|
||||||
.build(),
|
.build(),
|
||||||
|
|
Loading…
Reference in a new issue