QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GstQgcSinkStats.h
Go to the documentation of this file.
1#pragma once
2
3#include <gst/gst.h>
4
5#include <QtCore/QString>
6
7#include "GstScoped.h"
9
10namespace GstQgc {
11
14const char* sinkFramesField(HwVideoBufferPath path);
15
18inline constexpr const char* kSupersededFramesField = "superseded-frames";
19
21inline constexpr const char* kGpuFallbacksField = "gpu-fallbacks";
22
24inline constexpr const char* kStreamDemotionsField = "stream-demotions";
25
28inline constexpr const char* kTiledDropsField = "tiled-drops";
29
32
34inline quint64 frameStatsField(const GstStructure* stats, const char* field) noexcept
35{
36 guint64 value = 0;
37 if (stats) {
38 (void) gst_structure_get_uint64(stats, field, &value);
39 }
40 return value;
41}
42
44inline quint64 frameStatsGrowth(const GstStructure* stats, const GstStructure* since, const char* field) noexcept
45{
46 const quint64 now = frameStatsField(stats, field);
47 const quint64 before = frameStatsField(since, field);
48 return (now > before) ? (now - before) : 0;
49}
50
53{
54 QString line;
55 quint64 totalDelivered = 0;
56};
57
61PathStats formatSinkStats(const GstStructure* stats, const GstStructure* since = nullptr);
62
63} // namespace GstQgc
HwVideoBufferPath
GPU zero-copy path a frame is imported through; None means the frame takes the CPU path.
Definition GstHwTypes.h:7
struct _GstElement GstElement
std::unique_ptr< GstStructure, GstStructureDeleter > GstStructurePtr
Definition GstScoped.h:70
GstVideoSink that pushes decoded frames into a Qt QVideoSink; sole sink in qgcvideosinkbin....
const char * sinkFramesField(HwVideoBufferPath path)
quint64 frameStatsGrowth(const GstStructure *stats, const GstStructure *since, const char *field) noexcept
How far the guint64 field grew from since to stats, two "frame-stats" values of the same sink.
constexpr const char * kSupersededFramesField
PathStats formatSinkStats(const GstStructure *stats, const GstStructure *since)
constexpr const char * kGpuFallbacksField
guint64 "frame-stats" field holding the frames a GPU path was tried for but the CPU delivered.
quint64 frameStatsField(const GstStructure *stats, const char *field) noexcept
The guint64 field of stats, a "frame-stats" or any other structure; 0 without the structure or the fi...
constexpr const char * kStreamDemotionsField
guint64 "frame-stats" field holding the caps epochs that started on a GPU path and fell back to the C...
GStreamer::GstStructurePtr frameStats(GstElement *sinkOrBin)
The "frame-stats" of sinkOrBin, a qgcqvideosink or the qgcvideosinkbin around one; null for other ele...
constexpr const char * kTiledDropsField
Formatted per-path frame counts + the total delivered through GPU paths.