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

#include <StreamWatchdog.h>

Classes

struct  Result

Public Types

enum class  Stall { None , Source , Decoder }

Public Member Functions

void start (std::chrono::seconds timeout, std::optional< std::chrono::milliseconds > firstFrameGrace=std::chrono::milliseconds{0})
quint64 noteSourceFrame (qint64 nowMs)
 Returns the number of source frames since start().
bool noteSinkFrame (qint64 nowMs)
 Returns true for the first sink frame since startSinkClock().
void noteFrameWithheld (qint64 nowMs)
void startSinkClock (qint64 nowMs)
 A decoder starts displaying at nowMs: its silence counts from here until the first sink frame.
Result check (qint64 nowMs, bool displaying)

Static Public Member Functions

static qint64 now ()

Detailed Description

Health of one receiver's stream: notices when frames stop arriving. StreamSupervisor paces the reconnects.

Times are monotonic milliseconds from now(), passed in so the policy can be checked without waiting on a clock. Threading: noteSourceFrame() and noteSinkFrame() run on streaming threads; everything else on the receiver's worker.

Definition at line 14 of file StreamWatchdog.h.

Member Enumeration Documentation

◆ Stall

enum class StreamWatchdog::Stall
strong
Enumerator
None 
Source 

No frame reached the tee within the timeout.

Decoder 

Displaying, but no frame reached the video sink within twice the timeout.

Definition at line 17 of file StreamWatchdog.h.

Member Function Documentation

◆ check()

StreamWatchdog::Result StreamWatchdog::check ( qint64 nowMs,
bool displaying )

The first check without a source frame starts the source timeout, where the first frame has one. displaying: a decoder is inserted, so sink frames are due.

Definition at line 58 of file StreamWatchdog.cc.

References Decoder, and Source.

◆ noteFrameWithheld()

void StreamWatchdog::noteFrameWithheld ( qint64 nowMs)

A frame is kept from the decoder at nowMs, as by the display's keyframe gate: the decoder owes no frame for it, so its silence counts from here.

Definition at line 47 of file StreamWatchdog.cc.

◆ noteSinkFrame()

bool StreamWatchdog::noteSinkFrame ( qint64 nowMs)

Returns true for the first sink frame since startSinkClock().

Definition at line 41 of file StreamWatchdog.cc.

◆ noteSourceFrame()

quint64 StreamWatchdog::noteSourceFrame ( qint64 nowMs)

Returns the number of source frames since start().

Definition at line 34 of file StreamWatchdog.cc.

◆ now()

qint64 StreamWatchdog::now ( )
static

Definition at line 15 of file StreamWatchdog.cc.

References MonotonicClock::nowMs().

◆ start()

void StreamWatchdog::start ( std::chrono::seconds timeout,
std::optional< std::chrono::milliseconds > firstFrameGrace = std::chrono::milliseconds{0} )

Watches a new pipeline, which stalls after timeout (at least 1 s) without frames. Before its first frame it stalls after timeout plus firstFrameGrace, or never without one (nullopt).

Definition at line 20 of file StreamWatchdog.cc.

◆ startSinkClock()

void StreamWatchdog::startSinkClock ( qint64 nowMs)

A decoder starts displaying at nowMs: its silence counts from here until the first sink frame.

Definition at line 52 of file StreamWatchdog.cc.


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