Skip to content

gstbasesrc: Do not hold LIVE_LOCK while sending events

Johan Sternerup requested to merge johast/gstreamer:basesrc_unlock_live into main

An application that triggers a state transition from PLAYING to PAUSED needs to acquire the LIVE_LOCK. Consequently the LIVE_LOCK must not be taken while pushing anything on the pads because this operation might get blocked by something that cannot be unblocked without the application being able to proceed with the state transitions for other elements in the pipeline. This commit extends the previous behaviour where the live lock was released before pushing buffers (indirectly through the unlock before subclass->create) to now also include unlocking before pushing events.

The issue was discovered in a case for WebRTC where the application tried to shut down a pipeline but an event originating from a video source element (based on basesrc) was in the process of being pushed down the pipeline when it got stuck on the STREAM_LOCK for the pad after the rtpgccbwe element. This lock in turn was held by the rtcpgccbwe element as it was in the process of pushing data down the pipeline but was stuck on the blocking probes installed on dtlssrtpenc to prevent data from flowing before dtls keys had been negotiated. What should have happened here is that the blocking probes should be removed, but that can only happen if the application may continue driving the state transitions.

Merge request reports