QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PipelineSession Class Reference

One receiver pipeline: source ! tee, with the display and recording branches behind the tee. More...

#include <PipelineSession.h>

Inheritance diagram for PipelineSession:
Collaboration diagram for PipelineSession:

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 ()

Detailed Description

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.

Constructor & Destructor Documentation

◆ PipelineSession()

PipelineSession::PipelineSession ( const Settings & settings,
Listener & listener,
StreamWatchdog & watchdog,
const PipelineDotDumper & dotDumper,
QObject * parent = nullptr )

Definition at line 150 of file PipelineSession.cc.

◆ ~PipelineSession()

PipelineSession::~PipelineSession ( )
override

Definition at line 159 of file PipelineSession.cc.

References shutdown().

Member Function Documentation

◆ displaying()

bool PipelineSession::displaying ( ) const

Definition at line 269 of file PipelineSession.cc.

◆ pipeline()

GstElement * PipelineSession::pipeline ( ) const
inline

Definition at line 94 of file PipelineSession.h.

◆ restartDecoder()

void PipelineSession::restartDecoder ( const char * reason)

Definition at line 262 of file PipelineSession.cc.

◆ sampleStats()

◆ setRecording()

void PipelineSession::setRecording ( const std::optional< RecordingBranch::Request > & request)

Definition at line 255 of file PipelineSession.cc.

◆ setVideoSink()

void PipelineSession::setVideoSink ( GstElement * sink)

Definition at line 248 of file PipelineSession.cc.

◆ shutdown()

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().

◆ sinkPathStats()

GstQgc::PathStats PipelineSession::sinkPathStats ( ) const

Definition at line 274 of file PipelineSession.cc.

Referenced by shutdown().

◆ snapshot()

void PipelineSession::snapshot ( const QString & tag) const

Writes PipelineDotDumper::snapshot() of the pipeline under tag.

Definition at line 295 of file PipelineSession.cc.

◆ start()

std::optional< PipelineSession::Failure > PipelineSession::start ( )
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().


The documentation for this class was generated from the following files: