The RTSP source GStreamer::SourceFactory::create() builds, with QGC's transport, latency and retransmission policy. More...
Classes | |
| struct | Config |
Enumerations | |
| enum class | JitterBuffer { None , DropOnLatency } |
| enum class | Transport |
Functions | |
| void | configureH26xParser (GstElement *element) |
| void | configureH26xRtpDepayloader (GstElement *element, bool requestKeyframes) |
| void | gateOnParameterSets (GstPad *depayloaderSrc, bool h265) |
| bool | isValidRtspUri (const gchar *uri_str) |
| True for a syntactically valid rtsp* URI with a host. | |
| bool | isVideoMedia (const GstStructure *structure) |
| SDP-derived caps carry the stream's media type; audio and metadata streams must never reach the video parser. | |
| GstElementPtr | buildRtspSource (const QString &uri, const QUrl &sourceUrl, const Config &config, guint latencyMs) |
| int | udpReceiveBufferSize () |
| void | reportDroppedPackets (GstElement *jitterBuffer) |
| GstElement * | create (const QString &uri, const Config &config) |
| std::optional< std::chrono::milliseconds > | connectGracePeriod (const QString &uri) |
Variables | |
| constexpr std::chrono::milliseconds | kRtspUdpTimeout {5000} |
| rtspsrc waits this long for UDP data before it retries the session over TCP ("timeout"). | |
The RTSP source GStreamer::SourceFactory::create() builds, with QGC's transport, latency and retransmission policy.
|
strong |
RTP jitter-buffer policy for sources that produce application/x-rtp caps. Ignored for non-RTP sources (e.g. raw MPEG-TS over TCP).
| Enumerator | |
|---|---|
| None | No playout buffering; omits an explicit buffer or sets rtspsrc latency to zero. |
| DropOnLatency | rtpjitterbuffer with drop-on-latency=TRUE. |
Definition at line 17 of file GstSourceFactory.h.
|
strong |
Definition at line 11 of file VideoStreamUri.h.
| GstElementPtr GStreamer::SourceFactory::buildRtspSource | ( | const QString & | uri, |
| const QUrl & | sourceUrl, | ||
| const Config & | config, | ||
| guint | latencyMs ) |
A configured rtspsrc for uri, with sourceUrl's user info as its credentials, or null after logging why. latencyMs: the playout latency, unless config asks for no jitter buffer.
Definition at line 135 of file GstRtspSource.cc.
References GStreamer::SourceFactory::Config::doRetransmission, isValidRtspUri(), GStreamer::SourceFactory::Config::jitterBuffer, kRtspUdpTimeout, GStreamer::makeElement(), None, QGCNetworkHelper::redactedUrlForLogging(), and udpReceiveBufferSize().
Referenced by create().
| void GStreamer::SourceFactory::configureH26xParser | ( | GstElement * | element | ) |
When element is h264parse or h265parse, repeats the codec parameter sets at every IDR, so a recording started mid-stream can build its codec_data.
Definition at line 159 of file GstH26xParameterSetGate.cc.
References GStreamer::factoryNameOf().
| void GStreamer::SourceFactory::configureH26xRtpDepayloader | ( | GstElement * | element, |
| bool | requestKeyframes ) |
When element is rtph264depay or rtph265depay, gates its output on the parameter sets (gateOnParameterSets()) and, if requestKeyframes (the source has a return channel, RTSP's RTCP, that carries a keyframe request upstream), asks for a keyframe after packet loss.
Definition at line 170 of file GstH26xParameterSetGate.cc.
References GStreamer::adoptPad(), GStreamer::factoryNameOf(), and gateOnParameterSets().
| std::optional< std::chrono::milliseconds > GStreamer::SourceFactory::connectGracePeriod | ( | const QString & | uri | ) |
How much longer than the stream timeout the first data for uri may take: kRtspUdpTimeout for RTSP, whose UDP to TCP fallback must not be cut short, and zero for a TCP source. nullopt, any time at all, for a UDP source: it only listens on its port, so until somebody sends to it nothing has failed, and a new source would listen no better.
Definition at line 696 of file GstSourceFactory.cc.
References kRtspUdpTimeout, VideoStreamUri::listens(), and VideoStreamUri::transportFor().
| GstElement * GStreamer::SourceFactory::create | ( | const QString & | uri, |
| const Config & | config ) |
Build a source bin for uri: source [+ tsdemux] + parsebin, or for RTP over UDP udpsrc [+ rtpjitterbuffer] + the codec's depayloader and parser, which also take the place of an RTSP bin's parsebin once rtspsrc tells that its stream is H.264 or H.265. Supported schemes: rtsp/rtspt, tcp:// (MPEG-TS), udp:// (H.264 RTP), udp265:// (H.265 RTP), mpegts:// (MPEG-TS over UDP). A UDP URI with port 0 listens on a free port, and one without a host on every IPv4 address.
The RTP over UDP bin has its source pad from the start, and without a jitter buffer counts its RTP packets itself (GStreamer::rtpPacketCounts()). The others' ghost pads are wired lazily; for rtspsrc/tsdemux/parsebin they appear only after upstream produces pads, so callers must connect any downstream pad-added handlers before transitioning to PLAYING.
Returns the source bin or nullptr on failure.
Definition at line 600 of file GstSourceFactory.cc.
References GStreamer::addToBin(), GStreamer::adoptElement(), buildRtspSource(), GStreamer::SourceFactory::Config::latencyMs, QGCNetworkHelper::redactedUrlForLogging(), and VideoStreamUri::transportFor().
| void GStreamer::SourceFactory::gateOnParameterSets | ( | GstPad * | depayloaderSrc, |
| bool | h265 ) |
Holds an RTP H.264/H.265 depayloader's byte-stream output back until a full parameter set (SPS and PPS, plus VPS for H.265) has arrived, then emits the parameter sets together with the first slice and removes itself. create() applies it to every depayloader it builds or parsebin plugs; length-prefixed output is left alone.
Definition at line 186 of file GstH26xParameterSetGate.cc.
Referenced by configureH26xRtpDepayloader().
| bool GStreamer::SourceFactory::isValidRtspUri | ( | const gchar * | uri_str | ) |
True for a syntactically valid rtsp* URI with a host.
Definition at line 106 of file GstRtspSource.cc.
Referenced by buildRtspSource().
| bool GStreamer::SourceFactory::isVideoMedia | ( | const GstStructure * | structure | ) |
SDP-derived caps carry the stream's media type; audio and metadata streams must never reach the video parser.
Definition at line 130 of file GstRtspSource.cc.
| void GStreamer::SourceFactory::reportDroppedPackets | ( | GstElement * | jitterBuffer | ) |
Has jitterBuffer, an rtpjitterbuffer of a source (rtspsrc's included), tell of each packet it drops in a "drop-msg" element message: those it drops to stay within its latency ("drop-on-latency") are in none of its "stats", so PipelineStatsProbe counts them from the bus.
Definition at line 591 of file GstSourceFactory.cc.
| int GStreamer::SourceFactory::udpReceiveBufferSize | ( | ) |
The receive buffer, in bytes, the factory asks of every UDP socket of its sources, rtspsrc's included: 8 MiB, or as much as the kernel lets a socket ask for where that is less (Linux's net.core.rmem_max).
Definition at line 564 of file GstSourceFactory.cc.
Referenced by buildRtspSource().
|
inlineconstexpr |
rtspsrc waits this long for UDP data before it retries the session over TCP ("timeout").
Definition at line 48 of file GstSourceFactory.h.
Referenced by buildRtspSource(), and connectGracePeriod().