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

@ -271,6 +271,8 @@ pa_sink* pa_sink_new(
else
s->alternate_sample_rate = s->core->alternate_sample_rate;
s->avoid_resampling = data->avoid_resampling;
s->inputs = pa_idxset_new(NULL, NULL);
s->n_corked = 0;
s->input_to_master = NULL;
@ -1444,7 +1446,7 @@ int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
pa_sink_input *i;
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 */
@ -1512,7 +1514,7 @@ int pa_sink_reconfigure(pa_sink *s, pa_sample_spec *spec, bool passthrough) {
if (!passthrough && pa_sink_used_by(s) > 0)
return -1;
pa_log_debug("Suspending sink %s due to changing format.", s->name);
pa_log_debug("Suspending sink %s due to changing format, desired rate = %u", s->name, desired_spec.rate);
pa_sink_suspend(s, true, PA_SUSPEND_INTERNAL);
if (s->reconfigure(s, &desired_spec, passthrough) >= 0) {