diff options
author | Sangchul Lee <sangchul1011@gmail.com> | 2018-05-25 01:29:53 +0900 |
---|---|---|
committer | Arun Raghavan <arun@arunraghavan.net> | 2018-06-21 06:30:25 +0530 |
commit | ef094638f552a9cd8006a3f31da7d2c649104d5f (patch) | |
tree | 8a44fccbf4ae7aebde602a93bc824bef310d7971 /src/modules/alsa/alsa-sink.c | |
parent | 3b2a5bdc106fcdca8653a5d36470958d29a542b8 (diff) |
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>
Diffstat (limited to 'src/modules/alsa/alsa-sink.c')
-rw-r--r-- | src/modules/alsa/alsa-sink.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 8e1fa7b29..871c82922 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -2101,7 +2101,16 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark, rewind_safeguard; snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames; size_t frame_size; - bool use_mmap = true, b, use_tsched = true, d, ignore_dB = false, namereg_fail = false, deferred_volume = false, set_formats = false, fixed_latency_range = false; + bool use_mmap = true; + bool use_tsched = true; + bool ignore_dB = false; + bool namereg_fail = false; + bool deferred_volume = false; + bool set_formats = false; + bool fixed_latency_range = false; + bool b; + bool d; + bool avoid_resampling; pa_sink_new_data data; bool volume_is_set; bool mute_is_set; @@ -2113,6 +2122,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca ss = m->core->default_sample_spec; map = m->core->default_channel_map; + avoid_resampling = m->core->avoid_resampling; /* Pick sample spec overrides from the mapping, if any */ if (mapping) { @@ -2369,6 +2379,13 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca } data.namereg_fail = namereg_fail; + if (pa_modargs_get_value_boolean(ma, "avoid_resampling", &avoid_resampling) < 0) { + pa_log("Failed to parse avoid_resampling argument."); + pa_sink_new_data_done(&data); + goto fail; + } + data.avoid_resampling = avoid_resampling; + pa_sink_new_data_set_sample_spec(&data, &ss); pa_sink_new_data_set_channel_map(&data, &map); pa_sink_new_data_set_alternate_sample_rate(&data, alternate_sample_rate); |