webrtcsink deadlocks on gst_element_set_state GST_STATE_NULL
Describe your issue
I'm encountering deadlocks when I have a gstreamer pipeline with a webrtcsink element in it. Stopping the pipeline by changing the state to NULL makes the change state deadlock in some special cases.
Expected Behavior
That the pipeline is able to handle the state change.
Observed Behavior
Actually I see two issues,
- When the webrtcsink does not receive any frames. For example the appsrc is not pushing any buffers. The webrtcsink is not destructable, as going to the NULL state deadlocks.
- The webrtssink seems to deadlock in a time window of about 3s after the pipeline receives his first buffer and is started. After that period, the webrtcsink is properly destructable with the change state to NULL.
Setup
- Operating System: Linux 6.2.0-34-generic #34~22.04.1-Ubuntu x86_64
- Device: Computer
- gst-plugins-rs Version: gstreamer-1.22.8 and 0.11.3
- GStreamer Version: 1.20.3
- Command line:
Steps to reproduce the bug
I'm using the following pipeline (there is probably a simpler one that can reproduce it too): webrtcsink name=ws congestion-control=disabled signaller::address=ws://127.0.0.1:8443 appsrc name=video-appsrc is-live=true do-timestamp=0 format=time max-buffers=5 leaky-type=2 block=false ! video/x-raw, format=RGB, width=960, height=540 , framerate=25/1 ! videoconvert ! ws. audiotestsrc wave=silence ! audio/x-raw, format=F32LE, rate=48000, channels=2, layout=non-interleaved ! ws.
- Start a pipeline with the webrtcsink in it and don't push any buffers. Change the pipeline state to NULL.
- For the second related bug, stop the pipeline immediately after you started the pipeline.
How reproducible is the bug?
Always
Solutions you have tried
Switching to multiple versions of the plugins-rs did not solve the issue.
My current workaround
Currently to work around this issue, I push always a first buffer in the pipeline via the appsrc. When I want to stop the pipeline I check that the pipeline is already running for >3s and then I send execute the gst_element_set_state.