Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Latency tuner. More...
#include <latency_tuner.h>
Public Member Functions | |
LatencyTuner (const LatencyConfig &config, const SampleSpec &sample_spec) | |
Initialize. More... | |
bool | is_valid () const |
Check if the object was initialized successfully. More... | |
void | write_metrics (const LatencyMetrics &latency_metrics, const packet::LinkMetrics &link_metrics) |
Pass updated metrics to tuner. Tuner will use new values next time when update_stream() is called. More... | |
bool | update_stream () |
Update stream latency and scaling. This method performs all actual work: More... | |
void | advance_stream (packet::stream_timestamp_t duration) |
Advance stream by given number of samples. Should be called after updating stream. More... | |
float | fetch_scaling () |
If scaling has changed, returns updated value. Otherwise, returns zero. More... | |
Latency tuner.
On receiver, LatencyMonitor computes local metrics and passes them to LatencyTuner. On sender, FeedbackMonitor obtains remote metrics and passes them to LatencyTuner. In both cases, LatencyTuner processes metrics and computes scaling factor that should be passed to resampler.
Features:
Definition at line 167 of file latency_tuner.h.
roc::audio::LatencyTuner::LatencyTuner | ( | const LatencyConfig & | config, |
const SampleSpec & | sample_spec | ||
) |
Initialize.
void roc::audio::LatencyTuner::advance_stream | ( | packet::stream_timestamp_t | duration | ) |
Advance stream by given number of samples. Should be called after updating stream.
float roc::audio::LatencyTuner::fetch_scaling | ( | ) |
If scaling has changed, returns updated value. Otherwise, returns zero.
bool roc::audio::LatencyTuner::is_valid | ( | ) | const |
Check if the object was initialized successfully.
bool roc::audio::LatencyTuner::update_stream | ( | ) |
Update stream latency and scaling. This method performs all actual work:
void roc::audio::LatencyTuner::write_metrics | ( | const LatencyMetrics & | latency_metrics, |
const packet::LinkMetrics & | link_metrics | ||
) |
Pass updated metrics to tuner. Tuner will use new values next time when update_stream() is called.