[GStreamer 1.19] How to restore the pipeline to PLAYING state after RTMP disconnect

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GStreamer 1.19] How to restore the pipeline to PLAYING state after RTMP disconnect

GStreamer-devel mailing list
Hi all.

I am using Gstreamer 1.19. I build the pipeline from decklinksrc to rmtp2src
for streaming video from DeckLink card to my RTMP server.
If RTMP server is already up, everything is working well as expected.
Here is my pipeline in CLI format:


My goal is to catch situation when RTMP is down, wait for rising RTMP up,
reconnect and restart pipeline to play video again as well.

I didn't find any way to get some event from rtmp2sink element about
disconnect, so I used a bus callback. When I got GST_MESSAGE_ERROR message,
I checked if the sender was rtmp2sink.
If so, I assume that disconnect happens.  I create a timer with a callback
for waiting when RTMP becomes up and rebuild the pipeline inside this
callback.

For rebuilding I use the technique, described in this manual:
https://gstreamer.freedesktop.org/documentation/application-development/advanced/pipeline-manipulation.html?gi-language=c#changing-elements-in-a-pipeline

Also I used the GST_DEBUG_BIN_TO_DOT_FILE macro on each step to be sure that
each step was passed successfully.

So the problem is rtmp2sink after recreating doesn't switch to PLAYING
state. I cannot understand why.

For experiments, I tried to use this code in some timer. e.g. rebuild
pipeline every 15 seconds, and everything was work as well. Pipeline
switches to PLAYING state as well and I got the videostream in player.

It seems like I didn't handle or didn't fix one more thing in my error
handler... And I cannot figure out what exactly.

Here is a pipeline diagram after rebuilding pipeline
<http://gstreamer-devel.966125.n4.nabble.com/file/t380037/reconnect_08_end_of_rebuild.png>



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel