One receiver pipeline: source ! tee, with the display and recording branches behind the tee. More...
#include <PipelineSession.h>
Classes | |
| struct | Settings |
| struct | Failure |
| class | Listener |
Public Member Functions | |
| PipelineSession (const Settings &settings, Listener &listener, StreamWatchdog &watchdog, const PipelineDotDumper &dotDumper, QObject *parent=nullptr) | |
| ~PipelineSession () override | |
| std::optional< Failure > | start () |
| Builds the pipeline and sets it PLAYING. Returns why when it can't; shut the session down then. | |
| void | setVideoSink (GstElement *sink) |
| void | setRecording (const std::optional< RecordingBranch::Request > &request) |
| void | restartDecoder (const char *reason) |
| bool | displaying () const |
| GstQgc::PathStats | sinkPathStats () const |
| void | sampleStats (VideoStreamStatsMeter::Counters &counters, VideoStreamStats &stats) |
| GstElement * | pipeline () const |
| void | snapshot (const QString &tag) const |
Writes PipelineDotDumper::snapshot() of the pipeline under tag. | |
| void | shutdown () |
One receiver pipeline: source ! tee, with the display and recording branches behind the tee.
Lives on the receiver's worker thread and owns everything about its pipeline: the elements, the bus, the probes and the branches. Streaming threads hand their work to the session as queued calls, so once shutdown() has stopped the pipeline and detached the bus, deleting the session drops whatever they left behind.
Bus handling, through a GstBusPump: a sync handler does only what can't wait (GPU context requests, stream selection, and closing the valve in front of a failing branch); everything else is popped on the worker, where the bus's poll fd wakes it up.
The session recovers its branches from their errors itself: a failing decoder is replaced, a failing recorder ends the recording. A stalled decoder is the listener's to notice, and to replace through restartDecoder(). Failures of the stream as a whole go to the Listener, which decides whether to reconnect.
Definition at line 38 of file PipelineSession.h.
| PipelineSession::PipelineSession | ( | const Settings & | settings, |
| Listener & | listener, | ||
| StreamWatchdog & | watchdog, | ||
| const PipelineDotDumper & | dotDumper, | ||
| QObject * | parent = nullptr ) |
Definition at line 150 of file PipelineSession.cc.
|
override |
Definition at line 159 of file PipelineSession.cc.
References shutdown().
| bool PipelineSession::displaying | ( | ) | const |
Definition at line 269 of file PipelineSession.cc.
|
inline |
Definition at line 94 of file PipelineSession.h.
| void PipelineSession::restartDecoder | ( | const char * | reason | ) |
Definition at line 262 of file PipelineSession.cc.
| void PipelineSession::sampleStats | ( | VideoStreamStatsMeter::Counters & | counters, |
| VideoStreamStats & | stats ) |
Measures the stream for VideoStreamStats: its cumulative counters into counters, for VideoStreamStatsMeter, and what it is now into stats (latency, RTP jitter, codec, decoder and display path). Not const: the display path is the one most frames took since the previous call.
Definition at line 279 of file PipelineSession.cc.
References VideoStreamStats::decoder, DecodingBranch::StatsSample::decoderRestarts, VideoStreamStats::decoderRestarts, DecodingBranch::StatsSample::displayPath, DecodingBranch::StatsSample::framesDisplayed, VideoStreamStatsMeter::Counters::framesDisplayed, DecodingBranch::StatsSample::framesDropped, VideoStreamStatsMeter::Counters::framesDropped, DecodingBranch::StatsSample::gpuFallbacks, VideoStreamStats::gpuFallbacks, VideoStreamStats::gpuPath, and VideoStreamStats::hardwareDecoder.
| void PipelineSession::setRecording | ( | const std::optional< RecordingBranch::Request > & | request | ) |
Definition at line 255 of file PipelineSession.cc.
| void PipelineSession::setVideoSink | ( | GstElement * | sink | ) |
Definition at line 248 of file PipelineSession.cc.
| void PipelineSession::shutdown | ( | ) |
Drains an open recording into its file (at most RecordingBranch::kFinalizeTimeout), stops the pipeline and detaches the bus: nothing the pipeline does reaches the session afterwards. Reports the end of decoding and of the recording to the listener. Idempotent; the destructor calls it too.
Definition at line 300 of file PipelineSession.cc.
References RecordingBranch::kFinalizeTimeout, GstQgc::PathStats::line, sinkPathStats(), and GstQgc::PathStats::totalDelivered.
Referenced by ~PipelineSession().
| GstQgc::PathStats PipelineSession::sinkPathStats | ( | ) | const |
Definition at line 274 of file PipelineSession.cc.
Referenced by shutdown().
| void PipelineSession::snapshot | ( | const QString & | tag | ) | const |
Writes PipelineDotDumper::snapshot() of the pipeline under tag.
Definition at line 295 of file PipelineSession.cc.
|
nodiscard |
Builds the pipeline and sets it PLAYING. Returns why when it can't; shut the session down then.
Definition at line 164 of file PipelineSession.cc.
References GStreamer::adoptFloating().