mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
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:
parent
3b2a5bdc10
commit
ef094638f5
8 changed files with 64 additions and 8 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ struct pa_sink {
|
|||
pa_channel_map channel_map;
|
||||
uint32_t default_sample_rate;
|
||||
uint32_t alternate_sample_rate;
|
||||
bool avoid_resampling:1;
|
||||
|
||||
pa_idxset *inputs;
|
||||
unsigned n_corked;
|
||||
|
|
@ -376,6 +377,7 @@ typedef struct pa_sink_new_data {
|
|||
pa_sample_spec sample_spec;
|
||||
pa_channel_map channel_map;
|
||||
uint32_t alternate_sample_rate;
|
||||
bool avoid_resampling:1;
|
||||
pa_cvolume volume;
|
||||
bool muted:1;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ struct pa_source {
|
|||
pa_channel_map channel_map;
|
||||
uint32_t default_sample_rate;
|
||||
uint32_t alternate_sample_rate;
|
||||
bool avoid_resampling:1;
|
||||
|
||||
pa_idxset *outputs;
|
||||
unsigned n_corked;
|
||||
|
|
@ -314,6 +315,7 @@ typedef struct pa_source_new_data {
|
|||
pa_sample_spec sample_spec;
|
||||
pa_channel_map channel_map;
|
||||
uint32_t alternate_sample_rate;
|
||||
bool avoid_resampling:1;
|
||||
pa_cvolume volume;
|
||||
bool muted:1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue