GstRtspSink - Independent Stream Control

From RidgeRun Developer Wiki

Follow Us On Twitter LinkedIn Email Share this page



Previous: Basic_Authentication Index Next: Simple_Examples



rtspsink can expose independent control points for each stream branch, which is useful when you need fine-grained synchronization or buffering behavior. This page explains the child-property pattern and why it matters in advanced pipelines.


Why independent stream control matters

In a multi-stream pipeline, each stream can have different buffering and synchronization needs. For example, a preview stream may favor low latency while a recording or analysis stream may favor stable buffering.

Internal appsink

Inside of rtspsink, each independent media stream is consumed by an appsink. rtspsink allows the user to configure each stream's appsink independently. 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::max-buffers=3

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 max-buffers property to 3 will limit the maximum number of buffers to be held in the internal queue to 3 (a buffering of 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 have a buffering of 5 (max-buffers=5) while the audio was configured to have a max buffering of 1000 (max-buffers=1000). The name given to each appsink is set on the stream creation order.

gst-launch-1.0 rtspsink service=5000 name=sink rtspsinkpad0::max-buffers=5 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

Typical uses

  • Reduce latency for one mapping
  • Tune synchronization behavior per stream
  • Debug one stream branch without affecting all others

Practical advice

  • Name mappings consistently so each branch is easy to identify
  • Document which child property changes are safe in production
  • Validate client behavior after changing sync or buffering-related settings

Summary

Independent stream control is most useful in advanced multi-stream deployments where each published mapping has different runtime requirements.


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


Related pages

FAQ

Is independent stream control needed for all deployments?
No. It is mainly useful in advanced pipelines where different mappings need different runtime behavior.
How do I configure a per-stream property?
Use child-proxy notation such as rtspsinkpad0::property=value.


Previous: Basic_Authentication Index Next: Simple_Examples