On Sat, 28 Jan 2017, at 10:17 PM, Tanu Kaskinen wrote: > On Sat, 2017-01-28 at 13:26 +0530, Arun Raghavan wrote: > > This adds an "avoid-resampling" option to daemon.conf that makes the > > daemon try to use the stream sample rate if possible (the device needs > > to support it, which currently only ALSA does), and there should not be > > any other stream connected). > > > > This should enable some of the "audiophile" use-cases where users wish > > to play high sample rate audio files without resampling. > > > > We still will do conversion, though which means that the 96/24 case will > > require that the default format be set to be 24-bit as well, this will > > force all streams to be upconverted, which other than the wasted > > resources should be relatively harmless. > > That last paragraph isn't entirely coherent. Feel free to copy-paste > this: > > Audiophiles who demand "no modification of audio", please note: > avoiding sample rate coversion doesn't necessarily mean that we don't > have to do any conversion. We don't reconfigure the sink/source sample > format dynamically based on the stream format, so if there are > mismatches between the device and stream sample formats (e.g. 16-bit > vs. 24-bit), then the samples have to be converted. I'll fix up the commit message based on this and Peter's comments. > > @@ -1442,7 +1443,12 @@ int pa_sink_update_rate(pa_sink *s, uint32_t rate, bool passthrough) { > > if (PA_UNLIKELY(!pa_sample_rate_valid(desired_rate))) > > return -1; > > > > - if (!passthrough && default_rate != desired_rate && alternate_rate != desired_rate) { > > + if (avoid_resampling) { > > + /* We just try to set the sink input's sample rate if it's not too low */ > > + if (rate > default_rate || rate > alternate_rate) > > + desired_rate = rate; > > This doesn't work. desired_rate is already set to rate, so this does > nothing. The assignment is redundant, but I'd rather leave the assignment for clarity. What it _does_ do is avoid the calculation that chooses a desired rate that is either the default or alternate sample rates. Regards, Arun