Dynamic plugging

Tonu Jaansoo chain at bsd.ee
Wed Aug 23 09:55:14 UTC 2017


Hi!

I have been using this commandline so far  (basically raw audio+video are compressed into file and also into rtspclientsink with different bitrates): 


                "imxv4l2videosrc device=/dev/video0 imx-capture-mode=4 fps-n=30 ! tee name=rawVideo "
                "alsasrc ! audio/x-raw,format=S16LE,rate=48000,channels=1 ! audioconvert ! tee name=rawAudio "
//
                "rawVideo. ! queue ! imxvpuenc_h264 bitrate={streamVideoBitrate} ! video/x-h264,profile=baseline ! h264parse ! queue ! rtspsink. "
                "rawAudio. ! queue ! imxmp3audioenc bitrate={streamAudioBitrate} ! mpegaudioparse ! queue !  rtspsink. "
                "rtspclientsink location=rtsp://{streamIP}:{streamPort}/test profiles=4 name=rtspsink latency=3000 ";
//
                "rawVideo. ! queue ! imxvpuenc_h264 bitrate=5000 ! video/x-h264,profile=baseline ! h264parse ! queue ! mux. "
                "rawAudio. ! queue ! imxmp3audioenc bitrate=160 ! mpegaudioparse ! queue ! mux. "
                "mpegtsmux name=mux ! multifilesink location=/storage/video_{datetime}_%04d.ts next-file=4 max-file-size=10000000 "


Now this commandline has problem. When internet connection fails for a second, rtspclientsink tears down everything - also writing to files. I want that when internet fails, audio+video is still being captured into files. Currently I have different commandline without rtspclientsink branches that I use when there is no internet.

I am trying to rewrite this in C, but so that I intercept rtspclientsink having no connection and dynamically unpluging RTSP branches of the pipeline.

Something like this is correct way to do it?

* wait on bus for error message from rtspclientsink
* when error comes, set all elements from q1 and q3 to rtspclientsink to NULL
* also remove those elements from bin
* wait 10s to retry connection
* dynamically add all elements that were removed 
* set set their status to PLAYING

I have tried something like this. I get no errors, but no luck getting stream going. 
Also, I know there is an example for dynamically pluging things, but that did not help me so much to get my thing running.

Tonu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170823/e4e8b466/attachment-0001.html>


More information about the gstreamer-devel mailing list