QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GstQgcPathSession.cc
Go to the documentation of this file.
1#include "GstQgcPathSession.h"
2
3#include <utility>
4
5#include <QtCore/QLoggingCategory>
6
7#include "GstQgcFrameMap.h"
9
10Q_DECLARE_LOGGING_CATEGORY(GstQgcQVideoSinkLog)
11
12namespace GstQgc {
13
15{
16 _pathCache = HwResolvedPathCache{};
17 _demotionRecorded = false;
18 _tiledDropLogged = false;
19}
20
22{
23 startEpoch();
24 _consecutiveMapFailures = 0;
25}
26
28{
29 const quint64 failures = ++_consecutiveMapFailures;
30 if (mapped.noCpuLayout) {
31 // Until upstream renegotiates (the sink asked for it when the DMABuf import stopped), or the run escalates.
32 counters.noteTiledDrop();
33 if (!std::exchange(_tiledDropLogged, true)) {
34 qCWarning(GstQgcQVideoSinkLog) << "tiled DMA_DRM frame not imported and has no CPU layout — dropped";
35 }
36 } else if ((failures & 0x3F) == 1) {
37 qCWarning(GstQgcQVideoSinkLog) << "mapping failed, consecutive=" << failures;
38 }
39 if (failures >= kMaxConsecutiveMapFailures) {
40 qCWarning(GstQgcQVideoSinkLog) << failures << "consecutive map failures — erroring out";
41 return Verdict::Error;
42 }
43 return Verdict::Drop;
44}
45
47{
48 if (mapped.demoted) {
49 counters.noteGpuFallback(!std::exchange(_demotionRecorded, true));
50 }
51}
52
53} // namespace GstQgc
@ Drop
Drop the frame and go on.
void stop()
The sink stopped: as startEpoch(), and a run of map failures ends.
Verdict onMapFailed(const MappedFrame &mapped, SinkCounters &counters)
static constexpr quint64 kMaxConsecutiveMapFailures
A run of map failures this long is a broken import, not a hiccup: the stream fails so it is set up an...
void onDelivered(const MappedFrame &mapped, SinkCounters &counters)
void startEpoch()
New caps: the path is resolved anew, and the once-per-epoch bookkeeping starts over.
qgcqvideosink's frame accounting: what its frames-input, frames-dropped and frames-delivered properti...
void noteGpuFallback(bool firstOfEpoch)
A GPU path was tried for a frame the CPU delivered; firstOfEpoch: the caps epoch's first,...
void noteTiledDrop()
A frame in a tiled DMA_DRM layout no GPU path imported and the CPU can't read.
GstVideoSink that pushes decoded frames into a Qt QVideoSink; sole sink in qgcvideosinkbin....
bool demoted
A GPU path was requested for this stream but this frame fell back to CPU.
bool noCpuLayout
Dropped instead of read as linear rows, which would show it scrambled.