vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
filllevel.cpp
Go to the documentation of this file.
1
18#include <algorithm>
19
20#include "filllevel.h"
21#include "logger.h"
22
32
33
42
57void cBufferFillLevelLowPassFilter::UpdateAvgBufferFillLevel(int hardwareBufferFillLevelFrames)
58{
59 std::lock_guard<std::mutex> lock(m_mutex);
60
61 int bufferFillLevelFrames = m_receivedFrames - m_writtenToAlsaFrames + hardwareBufferFillLevelFrames;
62
64
65 switch (m_state) {
66 case UNINITIALIZED:
68 m_bufferFillLevelFramesAvg = bufferFillLevelFrames; // init with current value to speed up settling
71 break;
72 case SETTLING:
75 // fixate the current buffer fill level as target value, but guarantee a minimum buffer size
78 }
79 break;
80 case SETTLED:
81 // nothing
82 break;
83 }
84}
85
93{
94 switch(state) {
95 case UNINITIALIZED: return "UNINITIALIZED";
96 case SETTLING: return "SETTLING";
97 case SETTLED: return "SETTLED";
98 }
99 return "Unknown";
100}
void ResetFramesCounters()
Resets the received and written frames counters.
Definition filllevel.cpp:37
void UpdateAvgBufferFillLevel(int)
Updates the buffer fill level average.
Definition filllevel.cpp:57
static constexpr double FLOATING_AVERAGE_ALPHA_NORMAL
Definition filllevel.h:44
const char * StateToString(State d)
Converts the filter state to a string representation.
Definition filllevel.cpp:92
static constexpr double FLOATING_AVERAGE_ALPHA_SETTLING
Definition filllevel.h:43
static constexpr int SETTLING_DURATION_PACKETS
Definition filllevel.h:45
void Reset()
Resets the filter state.
Definition filllevel.cpp:26
Logger class header file.