Controlling the state of appsink pipeline depending on its RTSP appsrc clients

Mert Can Ergun mert.ergun at mikro-tasarim.com.tr
Tue Nov 29 12:04:08 UTC 2016


I have a hierarchy like below:

caps = "video/x-raw,width=640,height=512,format=GRAY8"

-SourcePipeline
---GstElement pipeline(has a videotestsrc and appsink)
---a GstAppSrc pointer array to push samples

-GstRTSPServer
---GstRTSPMediaFactory (has a GstAppSrc named "appsrc0" and mounted on
"/test")
---GstRTSPMediaFactory (has a GstAppSrc named "appsrc1" and mounted on
"/test2")

So, on media factories I listen for media-constructed signals and register
appsrc pointers to source pipeline. Also when their media changes state to
GST_STATE_NULL i remove the pointer from appsrc array in SourcePipeline.

On the source pipeline, appsink pushes the samples to appsrc one by one.
When there are no appsrcs left on the array, pipeline's state is changed to
GST_STATE_NULL until the first appsrc joins again.

I have some questions and problems:

1. When 1st client connects to RTSP, the client instantly gets the stream.
When the 2nd one joins on he 2nd mountpoint, stream pauses when GstRTSPMedia
changes its state to GST_STATE_PLAYING, and after 5 - 6 seconds stream
resumes again. This sometimes doesn't happen, though. The stream fails and I
can't get it up again before restarting the program.

2. Is my approach of controlling SourcePipeline correct? How should I do it
on an RTSP server?

3. I set appsrc's block property on TRUE. If I don't set it to true, It uses
all the memory, until system becomes unresponsive. Again, what is the right
approach here?

4. I am currently using push_sample to push buffers to appsrcs. What is the
difference between push_sample and push_buffer? Which is more effective?

5. When 2 clients on different mountpoints are watching the stream, it
breaks the stream down when 1 of them disconnects or stops the stream. I
check new-state signal on GstRTSPMedia to know RTSP pipeline's states.
Clearly this approach doesn't work, what is the correct one here?



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Controlling-the-state-of-appsink-pipeline-depending-on-its-RTSP-appsrc-clients-tp4680932.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list