QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VideoStreamStats.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QMetaType>
4#include <QtCore/QObject>
5#include <QtCore/QString>
6#include <QtQmlIntegration/QtQmlIntegration>
7
17{
18 Q_GADGET
19 QML_VALUE_TYPE(videoStreamStats)
20 Q_PROPERTY(bool valid MEMBER valid FINAL)
21 Q_PROPERTY(double fps MEMBER fps FINAL)
22 Q_PROPERTY(double bitrateKbps MEMBER bitrateKbps FINAL)
23 Q_PROPERTY(qint64 framesDropped MEMBER framesDropped FINAL)
24 Q_PROPERTY(bool hasRtpStats READ hasRtpStats FINAL)
25 Q_PROPERTY(qint64 packetsLost MEMBER packetsLost FINAL)
26 Q_PROPERTY(double lossPercent MEMBER lossPercent FINAL)
27 Q_PROPERTY(double jitterMs MEMBER jitterMs FINAL)
28 Q_PROPERTY(double latencyMs MEMBER latencyMs FINAL)
29 Q_PROPERTY(QString decoder MEMBER decoder FINAL)
30 Q_PROPERTY(bool hardwareDecoder MEMBER hardwareDecoder FINAL)
31 Q_PROPERTY(QString gpuPath MEMBER gpuPath FINAL)
32 Q_PROPERTY(QString codec MEMBER codec FINAL)
33 Q_PROPERTY(double droppedFps MEMBER droppedFps FINAL)
34 Q_PROPERTY(qint64 gpuFallbacks MEMBER gpuFallbacks FINAL)
35 Q_PROPERTY(qint64 decoderRestarts MEMBER decoderRestarts FINAL)
36 Q_PROPERTY(double keyframeIntervalMs MEMBER keyframeIntervalMs FINAL)
37 Q_PROPERTY(qint64 packetsLate MEMBER packetsLate FINAL)
38 Q_PROPERTY(qint64 packetsDuplicate MEMBER packetsDuplicate FINAL)
39 Q_PROPERTY(qint64 rtxRequested MEMBER rtxRequested FINAL)
40 Q_PROPERTY(qint64 rtxRecovered MEMBER rtxRecovered FINAL)
41 Q_PROPERTY(qint64 uptimeMs MEMBER uptimeMs FINAL)
42 Q_PROPERTY(int reconnects MEMBER reconnects FINAL)
43 Q_PROPERTY(qint64 recordingMs MEMBER recordingMs FINAL)
44 Q_PROPERTY(qint64 recordingBytes MEMBER recordingBytes FINAL)
45
46public:
47 bool hasRtpStats() const { return packetsLost >= 0; }
48
51 bool degraded(double cameraFps) const
52 {
53 return valid && ((lossPercent > 0) || (droppedFps > 0) || ((cameraFps > 0) && (fps < (cameraFps * 0.75))));
54 }
55
56 bool operator==(const VideoStreamStats&) const = default;
57
59 bool valid = false;
62 double fps = 0.0;
65 double bitrateKbps = 0.0;
67 qint64 framesDropped = 0;
69 qint64 packetsLost = -1;
71 double lossPercent = -1.0;
73 double jitterMs = -1.0;
75 double latencyMs = -1.0;
77 QString decoder;
78 bool hardwareDecoder = false;
81 QString gpuPath;
83 QString codec;
85 double droppedFps = 0.0;
87 qint64 gpuFallbacks = 0;
89 qint64 decoderRestarts = 0;
91 double keyframeIntervalMs = -1.0;
93 qint64 packetsLate = -1;
94 qint64 packetsDuplicate = -1;
96 qint64 rtxRequested = -1;
97 qint64 rtxRecovered = -1;
99 qint64 uptimeMs = 0;
101 int reconnects = 0;
103 qint64 recordingMs = -1;
104 qint64 recordingBytes = -1;
105};
106
107Q_DECLARE_METATYPE(VideoStreamStats)
double lossPercent
Share of the RTP packets due in the last interval that were lost.
bool degraded(double cameraFps) const
qint64 framesDropped
Since the stream started: frames the display dropped to keep up with the stream.
QString codec
"H.264", "H.265", ..., or a USB camera's capture format, such as "MJPEG" or "YUYV".
bool valid
Measured at least once for the current stream; the other fields mean nothing while false.
qint64 decoderRestarts
Since the stream started: times the decoder was replaced after an error or a stall.
QString decoder
The decoder's element factory, e.g. "avdec_h264".
double keyframeIntervalMs
Between keyframes, from their timestamps, averaged over the last few.
qint64 uptimeMs
Since the stream last connected.
double latencyMs
The pipeline's minimum latency, the playout delay it adds on top of the network's.
double jitterMs
RTP interarrival jitter (RFC 3550), averaged over the last packets.
qint64 packetsLate
Since the stream started: RTP packets that arrived after their playout time, and duplicate RTP packet...
int reconnects
Since the stream was started or restarted: reconnects after the stream failed.
bool operator==(const VideoStreamStats &) const =default
bool hasRtpStats() const
qint64 packetsLost
RTP packets lost since the stream started.
qint64 recordingMs
While recording: for how long, and the bytes written to its files so far.
double droppedFps
Frames dropped per second in the last interval.
qint64 rtxRequested
Since the stream started: RTP retransmissions requested (RTSP), and how many arrived in time.
qint64 gpuFallbacks
Since the stream started: frames a zero-copy GPU path was tried for but the CPU delivered.