Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::audio::LatencyMonitor Class Reference

Session latency monitor. More...

#include <latency_monitor.h>

Inheritance diagram for roc::audio::LatencyMonitor:
Collaboration diagram for roc::audio::LatencyMonitor:

Public Member Functions

 LatencyMonitor (const packet::SortedQueue &queue, const Depacketizer &depacketizer, ResamplerReader *resampler, const LatencyMonitorConfig &config, core::nanoseconds_t target_latency, size_t input_sample_rate, size_t output_sample_rate)
 Constructor. More...
bool valid () const
 Check if the object was initialized successfully. More...
bool update (packet::timestamp_t time)
 Update latency. More...

Detailed Description

Session latency monitor.

  • calculates session latency
  • calculates session scaling factor
  • trims scaling factor to the allowed range
  • updates resampler scaling
  • shutdowns session if the latency goes out of bounds

Definition at line 60 of file latency_monitor.h.

Constructor & Destructor Documentation

roc::audio::LatencyMonitor::LatencyMonitor ( const packet::SortedQueue queue,
const Depacketizer depacketizer,
ResamplerReader resampler,
const LatencyMonitorConfig config,
core::nanoseconds_t  target_latency,
size_t  input_sample_rate,
size_t  output_sample_rate 



  • queue and depacketizer are used to calculate the latency
  • resampler is used to set the scaling factor, may be null
  • config defines various miscellaneous parameters
  • target_latency defines FreqEstimator target latency, in samples
  • input_sample_rate is the sample rate of the input packets
  • output_sample_rate is the sample rate of the output frames

Member Function Documentation

bool roc::audio::LatencyMonitor::update ( packet::timestamp_t  time)

Update latency.

false if the session should be terminated.
bool roc::audio::LatencyMonitor::valid ( ) const

Check if the object was initialized successfully.

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