vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
filllevel.h
Go to the documentation of this file.
1
18#ifndef FILLLEVEL_H
19#define FILLLEVEL_H
20
21#include <mutex>
22
24public:
25 void Reset();
27 int GetFramesReceived() { std::lock_guard<std::mutex> lock(m_mutex); return m_receivedFrames; }
28 int GetFramesPlayed() { std::lock_guard<std::mutex> lock(m_mutex); return m_writtenToAlsaFrames; }
29 void ReceivedFrames(int count) { std::lock_guard<std::mutex> lock(m_mutex); m_receivedFrames += count; }
30 void WroteFrames(int count) { std::lock_guard<std::mutex> lock(m_mutex); m_writtenToAlsaFrames += count; }
31 double GetBufferFillLevelFramesAvg() { std::lock_guard<std::mutex> lock(m_mutex); return m_bufferFillLevelFramesAvg; }
32 void SetMinBufferSizeFrames(int size) { std::lock_guard<std::mutex> lock(m_mutex); m_minBufferSizeFrames = size; }
34 bool IsSettled() { std::lock_guard<std::mutex> lock(m_mutex); return m_state == SETTLED; }
35
36private:
42
43 constexpr static double FLOATING_AVERAGE_ALPHA_SETTLING = 0.02;
44 constexpr static double FLOATING_AVERAGE_ALPHA_NORMAL = 0.002;
45 constexpr static int SETTLING_DURATION_PACKETS = 30 / 0.16; // 30 seconds with one packet every 160ms
46
47 std::mutex m_mutex;
56
57 const char* StateToString(State d);
58};
59
60#endif
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
void ReceivedFrames(int count)
Definition filllevel.h:29
static constexpr double FLOATING_AVERAGE_ALPHA_SETTLING
Definition filllevel.h:43
static constexpr int SETTLING_DURATION_PACKETS
Definition filllevel.h:45
void WroteFrames(int count)
Definition filllevel.h:30
void SetMinBufferSizeFrames(int size)
Definition filllevel.h:32
void Reset()
Resets the filter state.
Definition filllevel.cpp:26