How to restart webrtc without stopping pipeline

Vladimir Tyutin vladimir.tyutin at gmail.com
Tue Jan 12 19:54:49 UTC 2021


Hello there,
I have a pipeline that contains audio/video streams muxing to ts files and
webrtc for p2p video chat with iOS and Android clients.
The idea is that ts files are capturing all the time and should be
interrupted and webrtc call should start by request from client side.
Everything works fine the first time. But when client stops the webrtc
session I need webrtcbin to be reset and ready for new connection. But I
need to do it without restarting whole pipeline. How to do this?

I tried to block src pads for video and audio queues and then remove
webrtcbin from pipeline and create it again. But it doesn't work.
If I block queue src pads it hangs in call:
gst_element_set_state (webrtc, GST_STATE_NULL);

If I unblock pads before this call it does not hangs and everything seems
to be ok but then I see errors that nice element is not linked.

So please advice the proper way to reset webrtcbin element without
restarting whole pipeline.

Here is my pipeline:
#define PIPELINE    "webrtcbin name=webrtc " STUN_SERVER_PROP "=" STUN_1 "
" STUN_SERVER_PROP "=" STUN_2 " " STUN_SERVER_PROP "=" STUN_3 " " \
                    STUN_SERVER_PROP "=" STUN_4 " " STUN_SERVER_PROP "="
STUN_5 " " TURN_SERVER_PROP "=" TURN_1 " " \
                    "mpegtsmux name=fullhdts ! hlssink max-files=100
target-duration=10 location=/mnt/ramdisk/fullhd_%09d.ts " \
                    "mpegtsmux name=vgats ! hlssink max-files=100
target-duration=10 location=/mnt/ramdisk/vga_%09d.ts " \
                    "v536videosrc sys-init=false device=1 channel=0
encoder=0 format=H264 width=1920 height=1080 ! video/x-h264,
stream-format=byte-stream, alignment=au, profile=baseline ! queue !
h264parse ! fullhdts. " \
                    "v536videosrc sys-init=false device=1 channel=1
encoder=1 format=H264 width=640 height=480 ! video/x-h264,
stream-format=byte-stream, alignment=au, profile=baseline ! tee name=tv !
queue ! h264parse ! vgats. " \
                    "alsasrc ! tee name=t ! queue ! avenc_aac ! aacparse !
fullhdts. " \
                    "t. ! queue ! avenc_aac ! aacparse ! vgats. " \
                    "tv. ! queue name=videoqueue leaky=downstream
max-size-buffers=25 ! rtph264pay name=vrtp ! capsfilter name=vrtpcaps
caps=" RTP_CAPS_H264 "96 ! webrtc. " \
                    "t. ! queue name=audioqueue leaky=downstream !
audioconvert name=aconvert ! opusenc ! rtpopuspay name=artp ! capsfilter
name=artpcaps caps=" RTP_CAPS_OPUS "97 ! webrtc. "
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210112/fc44a8bb/attachment.htm>


More information about the gstreamer-devel mailing list