</option>
<option>
+ <p><opt>avoid-resampling=</opt> If set, try to configure the
+ device to avoid resampling. This only works on devices which
+ support reconfiguring their rate, and when no other streams are
+ already playing or capturing audio. The device will also not be
+ configured to a rate less than the default and alternate sample
+ rates.</p>
+ </option>
+
+ <option>
<p><opt>enable-remixing=</opt> If disabled never upmix or
downmix channels to different channel maps. Instead, do a simple
name-based matching only. Defaults to <opt>yes.</opt></p>
.log_meta = false,
.log_time = false,
.resample_method = PA_RESAMPLER_AUTO,
+ .avoid_resampling = false,
.disable_remixing = false,
.remixing_use_all_sink_channels = true,
.disable_lfe_remixing = true,
{ "deferred-volume-extra-delay-usec",
pa_config_parse_int, &c->deferred_volume_extra_delay_usec, NULL },
{ "nice-level", parse_nice_level, c, NULL },
+ { "avoid-resampling", pa_config_parse_bool, &c->avoid_resampling, NULL },
{ "disable-remixing", pa_config_parse_bool, &c->disable_remixing, NULL },
{ "enable-remixing", pa_config_parse_not_bool, &c->disable_remixing, NULL },
{ "remixing-use-all-sink-channels",
pa_strbuf_printf(s, "log-target = %s\n", pa_strempty(log_target));
pa_strbuf_printf(s, "log-level = %s\n", log_level_to_string[c->log_level]);
pa_strbuf_printf(s, "resample-method = %s\n", pa_resample_method_to_string(c->resample_method));
+ pa_strbuf_printf(s, "avoid-resampling = %s\n", pa_yes_no(!c->avoid_resampling));
pa_strbuf_printf(s, "enable-remixing = %s\n", pa_yes_no(!c->disable_remixing));
pa_strbuf_printf(s, "remixing-use-all-sink-channels = %s\n", pa_yes_no(c->remixing_use_all_sink_channels));
pa_strbuf_printf(s, "enable-lfe-remixing = %s\n", pa_yes_no(!c->disable_lfe_remixing));
no_cpu_limit,
disable_shm,
disable_memfd,
+ avoid_resampling,
disable_remixing,
remixing_use_all_sink_channels,
disable_lfe_remixing,
; log-backtrace = 0
; resample-method = speex-float-1
+; avoid-resampling = false
; enable-remixing = yes
; remixing-use-all-sink-channels = yes
; enable-lfe-remixing = no
c->resample_method = conf->resample_method;
c->realtime_priority = conf->realtime_priority;
c->realtime_scheduling = conf->realtime_scheduling;
+ c->avoid_resampling = conf->avoid_resampling;
c->disable_remixing = conf->disable_remixing;
c->remixing_use_all_sink_channels = conf->remixing_use_all_sink_channels;
c->disable_lfe_remixing = conf->disable_lfe_remixing;
bool disallow_exit:1;
bool running_as_daemon:1;
bool realtime_scheduling:1;
+ bool avoid_resampling:1;
bool disable_remixing:1;
bool remixing_use_all_sink_channels:1;
bool disable_lfe_remixing:1;
pa_sink_input *i;
bool default_rate_is_usable = false;
bool alternate_rate_is_usable = false;
+ bool avoid_resampling = s->core->avoid_resampling;
if (rate == s->sample_spec.rate)
return 0;
if (!s->update_rate)
return -1;
- if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough)) {
+ if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough && !avoid_resampling)) {
pa_log_debug("Default and alternate sample rates are the same, so there is no point in switching.");
return -1;
}
if (PA_UNLIKELY(!pa_sample_rate_valid(desired_rate)))
return -1;
- if (!passthrough && default_rate != desired_rate && alternate_rate != desired_rate) {
+ if (avoid_resampling && (rate >= default_rate || rate >= alternate_rate)) {
+ /* We just try to set the sink input's sample rate if it's not too low */
+ desired_rate = rate;
+
+ } else if (!passthrough && default_rate != desired_rate && alternate_rate != desired_rate) {
if (default_rate % 11025 == 0 && desired_rate % 11025 == 0)
default_rate_is_usable = true;
if (default_rate % 4000 == 0 && desired_rate % 4000 == 0)
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;
if (rate == s->sample_spec.rate)
return 0;
if (!s->update_rate && !s->monitor_of)
return -1;
- if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough)) {
+ if (PA_UNLIKELY(default_rate == alternate_rate && !passthrough && !avoid_resampling)) {
pa_log_debug("Default and alternate sample rates are the same, so there is no point in switching.");
return -1;
}
if (PA_UNLIKELY(!pa_sample_rate_valid(desired_rate)))
return -1;
- if (!passthrough && default_rate != desired_rate && alternate_rate != desired_rate) {
+ if (avoid_resampling && (rate >= default_rate || rate >= alternate_rate)) {
+ /* We just try to set the source output's sample rate if it's not too low */
+ desired_rate = rate;
+
+ } else if (!passthrough && default_rate != desired_rate && alternate_rate != desired_rate) {
if (default_rate % 11025 == 0 && desired_rate % 11025 == 0)
default_rate_is_usable = true;
if (default_rate % 4000 == 0 && desired_rate % 4000 == 0)