GstRtspSink - Independent Stream Control

From RidgeRun Developer Wiki


Previous: Basic_Authentication Index Next: Simple_Examples




This wiki describes how to have advanced control over each independent stream by accessing the internal appsink. By doing so, synchronization, buffering, and other fine-grained control can be achieved.

Problems running the pipelines shown on this page? Please see our GStreamer Debugging guide for help.

Internal GstAppSink

GstRtspSink allows the user to control each stream independently by setting properties on them. Internally, each stream is consumed by an appsink named rtspsinkpadX. The user can access the appsink properties using the child proxy notation, as in the following example:

gst-launch-1.0 videotestsrc ! x264enc ! video/x-h264, mapping=/stream1  ! rtspsink service=5000 rtspsinkpad0::sync=false

In the example above, the pipeline consists of a single video stream and, as such, a single AppSink is created. You can modify the properties of this appsink to control the behavior of the pipeline. For example, setting the sync property to FALSE (the default) will result in a CPU usage is 320% since no-one is limiting the rate of the videotestsrc. On the other hand, setting the sync to TRUE will decrease the CPU usage to 9,3%

If multiple streams are created, they can be accessed independently. In the following example two streams are created (video and audio). The video stream was configured to sync against the clock (sync=true) while the audio was configured to have a max buffering of 1000 (max-buffers=1000). The number in the appsink is dictated by the stream creation order.

gst-launch-1.0 rtspsink service=5000 name=sink rtspsinkpad0::sync=true rtspsinkpad1::max-buffers=1000 \
videotestsrc ! vp8enc ! capsfilter caps="video/x-vp8, mapping=/stream0" ! sink. \
audiotestsrc ! avenc_ac3 ! capsfilter caps="audio/x-ac3, mapping=/stream1" ! sink.

GstAppSink Properties

The following table summarizes the appsink properties that may be configured for each stream:

Property Description Default
sync Sync on the clock true
max-lateness Maximum number of nanoseconds that a buffer can be late before it is dropped -1
qos Generate Quality-of-Service events upstream false
async Go asynchronously to PAUSED true
ts-offset Timestamp offset in nanoseconds 0
enable-last-sample Enable the last-sample property true
blocksize Size in bytes to pull per buffer 4096
render-delay Additional render delay of the sink in nanoseconds 0
throttle-time The time to keep between rendered buffers 0
max-bitrate The maximum bits per second to render 0
emit-signals Emit new-preroll and new-sample signals false
max-buffers The maximum number of buffers to queue internally 0
drop Drop old buffers when the buffer queue is filled false
wait-on-eos Wait for all buffers to be processed after receiving an EOS true

A more detailed list can always be retrieved by inspecting the appsink element.

gst-inspect-1.0 appsink



Previous: Basic_Authentication Index Next: Simple_Examples