record_play_mixer: make warning rate configurable

This patch disables latency warnings by default. The warnings can be
enabled by setting the 'warning_rate_ms` value to the desired
maximum rate.

Fixes #5186
Issue #5174
This commit is contained in:
Norman Feske 2024-04-19 11:30:44 +02:00
parent 85c99c238d
commit 084a14b114
3 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<launcher pkg="record_play_mixer" priority="0">
<config jitter_ms="10">
<config jitter_ms="10" warning_rate_ms="0">
<!--
These default wildcard rules match all regular play clients.
Please check the mixer report to replace the fuzzy configuration

View File

@ -98,3 +98,14 @@ Example
The _gems/run/waveform_player.run_ script illustrates the integration and
configuration of the mixer by using a waveform generator as play client and an
oscilloscope as record client.
Diagnostic features
~~~~~~~~~~~~~~~~~~~
The time-stable processing of audio streams depends on system-global
parameters such as the kernel scheduling and CPU affinities of the mixer,
drivers, and applications.
To assist with the integration of the mixer and with choosing sensible jitter
and period parameters, the config attribute 'warning_rate_ms' can be set to a
maximum rate at which timing violations are reported. The default value of "0"
suppresses those warning messages.

View File

@ -49,6 +49,8 @@ struct Mixer::Main : Record_session::Operations, Play_session::Operations
using Config_version = String<32>;
Config_version _version { };
unsigned _warning_rate_ms = 0;
Constructible<Clock> _clock_from_config { };
Time_window_scheduler::Config _global_record_config { };
@ -151,6 +153,11 @@ struct Mixer::Main : Record_session::Operations, Play_session::Operations
_config.update();
Xml_node const config = _config.xml();
unsigned const orig_warning_rate_ms = _warning_rate_ms;
_warning_rate_ms = config.attribute_value("warning_rate_ms", 0u);
if (orig_warning_rate_ms != _warning_rate_ms)
_timer.trigger_periodic(_warning_rate_ms*1000);
double const default_jitter_ms = config.attribute_value("jitter_ms", 1.0);
_global_record_config = {
.period_us = us_from_ms_attr(config, "record_period_ms", 5.0),
@ -223,7 +230,6 @@ struct Mixer::Main : Record_session::Operations, Play_session::Operations
_handle_config();
_timer.sigh(_timer_handler);
_timer.trigger_periodic(1000*1000);
_env.parent().announce(_env.ep().manage(_play_root));
_env.parent().announce(_env.ep().manage(_record_root));