udev-detect, alsa-card: Adopt avoid resampling option from daemon.conf

Previously, the "avoid-resampling" option of daemon.conf is to make the
daemon try to use the stream sample rate if possible for all sinks or
sources.

This patch applies this option to module-udev-detect and module-alsa-card
as a module argument in order to override the default value of daemon.conf.

As a result, user can use this argument for more fine-grained control.
e.g.) set it false in daemon.conf and set it true for module-udev-detect
or a particular module-alsa-card in default.pa.(or vice versa)

To set it, use "avoid_resampling=true or false" as the module argument.

Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
This commit is contained in:
Sangchul Lee 2018-05-25 01:29:53 +09:00 committed by Arun Raghavan
parent 3b2a5bdc10
commit ef094638f5
8 changed files with 64 additions and 8 deletions

View file

@ -258,6 +258,8 @@ pa_source* pa_source_new(
else
s->alternate_sample_rate = s->core->alternate_sample_rate;
s->avoid_resampling = data->avoid_resampling;
s->outputs = pa_idxset_new(NULL, NULL);
s->n_corked = 0;
s->monitor_of = NULL;
@ -1025,7 +1027,7 @@ int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, bool passthrough)
uint32_t alternate_rate = s->alternate_sample_rate;
bool default_rate_is_usable = false;
bool alternate_rate_is_usable = false;
bool avoid_resampling = s->core->avoid_resampling;
bool avoid_resampling = s->avoid_resampling;
/* We currently only try to reconfigure the sample rate */
@ -1093,7 +1095,7 @@ int pa_source_reconfigure(pa_source *s, pa_sample_spec *spec, bool passthrough)
if (!passthrough && pa_source_used_by(s) > 0)
return -1;
pa_log_debug("Suspending source %s due to changing the sample rate.", s->name);
pa_log_debug("Suspending source %s due to changing the sample rate to %u", s->name, desired_spec.rate);
pa_source_suspend(s, true, PA_SUSPEND_INTERNAL);
if (s->reconfigure)