vdr-plugin-softhddevice-drm-gles 1.6.2
cBufferFillLevelLowPassFilter Class Reference

Fill Level Low Pass Filter. More...

#include <filllevel.h>

Public Member Functions

void Reset ()
 Resets the filter state.
 
void ResetFramesCounters ()
 Resets the received and written frames counters.
 
int GetFramesReceived ()
 
int GetFramesPlayed ()
 
void ReceivedFrames (int count)
 
void WroteFrames (int count)
 
double GetBufferFillLevelFramesAvg ()
 
void SetMinBufferSizeFrames (int size)
 
void UpdateAvgBufferFillLevel (int)
 Updates the buffer fill level average.
 
bool IsSettled ()
 

Private Types

enum  State { UNINITIALIZED , SETTLING , SETTLED }
 

Private Member Functions

const charStateToString (State d)
 Converts the filter state to a string representation.
 

Private Attributes

std::mutex m_mutex
 
State m_state = UNINITIALIZED
 
int m_receivedFrames = 0
 
int m_writtenToAlsaFrames = 0
 
double m_bufferFillLevelFramesAvg = 0
 
double m_bufferFillLevelFramesTargetValue = 0
 
int m_frameCounter = 0
 
double m_floatingAverageAlpha = FLOATING_AVERAGE_ALPHA_NORMAL
 
int m_minBufferSizeFrames = 0
 

Static Private Attributes

static constexpr double FLOATING_AVERAGE_ALPHA_SETTLING = 0.02
 
static constexpr double FLOATING_AVERAGE_ALPHA_NORMAL = 0.002
 
static constexpr int SETTLING_DURATION_PACKETS = 30 / 0.16
 

Detailed Description

Fill Level Low Pass Filter.

Definition at line 23 of file filllevel.h.

Member Enumeration Documentation

◆ State

Enumerator
UNINITIALIZED 
SETTLING 
SETTLED 

Definition at line 37 of file filllevel.h.

Member Function Documentation

◆ GetBufferFillLevelFramesAvg()

double cBufferFillLevelLowPassFilter::GetBufferFillLevelFramesAvg ( )
inline

Definition at line 31 of file filllevel.h.

References m_bufferFillLevelFramesAvg, and m_mutex.

Referenced by cSoftHdAudio::ClockDriftCompensation().

◆ GetFramesPlayed()

int cBufferFillLevelLowPassFilter::GetFramesPlayed ( )
inline

Definition at line 28 of file filllevel.h.

References m_mutex, and m_writtenToAlsaFrames.

◆ GetFramesReceived()

int cBufferFillLevelLowPassFilter::GetFramesReceived ( )
inline

Definition at line 27 of file filllevel.h.

References m_mutex, and m_receivedFrames.

◆ IsSettled()

bool cBufferFillLevelLowPassFilter::IsSettled ( )
inline

Definition at line 34 of file filllevel.h.

References m_mutex, m_state, and SETTLED.

Referenced by cSoftHdAudio::ClockDriftCompensation().

◆ ReceivedFrames()

void cBufferFillLevelLowPassFilter::ReceivedFrames ( int  count)
inline

Definition at line 29 of file filllevel.h.

References m_mutex, and m_receivedFrames.

Referenced by cSoftHdAudio::Enqueue().

◆ SetMinBufferSizeFrames()

void cBufferFillLevelLowPassFilter::SetMinBufferSizeFrames ( int  size)
inline

Definition at line 32 of file filllevel.h.

References m_minBufferSizeFrames, and m_mutex.

◆ WroteFrames()

void cBufferFillLevelLowPassFilter::WroteFrames ( int  count)
inline

Definition at line 30 of file filllevel.h.

References m_mutex, and m_writtenToAlsaFrames.

Referenced by cSoftHdAudio::DropSamplesOlderThanPtsMs(), and cSoftHdAudio::SendAudio().

Member Data Documentation

◆ FLOATING_AVERAGE_ALPHA_NORMAL

constexpr double cBufferFillLevelLowPassFilter::FLOATING_AVERAGE_ALPHA_NORMAL = 0.002
staticconstexprprivate

Definition at line 44 of file filllevel.h.

Referenced by UpdateAvgBufferFillLevel().

◆ FLOATING_AVERAGE_ALPHA_SETTLING

constexpr double cBufferFillLevelLowPassFilter::FLOATING_AVERAGE_ALPHA_SETTLING = 0.02
staticconstexprprivate

Definition at line 43 of file filllevel.h.

Referenced by UpdateAvgBufferFillLevel().

◆ m_bufferFillLevelFramesAvg

double cBufferFillLevelLowPassFilter::m_bufferFillLevelFramesAvg = 0
private

Definition at line 51 of file filllevel.h.

Referenced by GetBufferFillLevelFramesAvg(), Reset(), and UpdateAvgBufferFillLevel().

◆ m_bufferFillLevelFramesTargetValue

double cBufferFillLevelLowPassFilter::m_bufferFillLevelFramesTargetValue = 0
private

Definition at line 52 of file filllevel.h.

Referenced by UpdateAvgBufferFillLevel().

◆ m_floatingAverageAlpha

double cBufferFillLevelLowPassFilter::m_floatingAverageAlpha = FLOATING_AVERAGE_ALPHA_NORMAL
private

Definition at line 54 of file filllevel.h.

Referenced by UpdateAvgBufferFillLevel().

◆ m_frameCounter

int cBufferFillLevelLowPassFilter::m_frameCounter = 0
private

Definition at line 53 of file filllevel.h.

Referenced by Reset(), and UpdateAvgBufferFillLevel().

◆ m_minBufferSizeFrames

int cBufferFillLevelLowPassFilter::m_minBufferSizeFrames = 0
private

Definition at line 55 of file filllevel.h.

Referenced by SetMinBufferSizeFrames(), and UpdateAvgBufferFillLevel().

◆ m_mutex

std::mutex cBufferFillLevelLowPassFilter::m_mutex
private

◆ m_receivedFrames

int cBufferFillLevelLowPassFilter::m_receivedFrames = 0
private

◆ m_state

State cBufferFillLevelLowPassFilter::m_state = UNINITIALIZED
private

Definition at line 48 of file filllevel.h.

Referenced by IsSettled(), Reset(), and UpdateAvgBufferFillLevel().

◆ m_writtenToAlsaFrames

int cBufferFillLevelLowPassFilter::m_writtenToAlsaFrames = 0
private

◆ SETTLING_DURATION_PACKETS

constexpr int cBufferFillLevelLowPassFilter::SETTLING_DURATION_PACKETS = 30 / 0.16
staticconstexprprivate

Definition at line 45 of file filllevel.h.

Referenced by UpdateAvgBufferFillLevel().


The documentation for this class was generated from the following files: