[pulseaudio-discuss] [RFC] Dynamic reconfiguration of sampling rate

Arun Raghavan arun.raghavan at collabora.co.uk
Sun Jan 23 22:02:18 PST 2011

On Tue, 2011-01-18 at 16:53 -0600, pl bossart wrote:
> >> In my normal usage, there is a potential (solvable) problem with this
> >> approach, though. I use Rhythmbox and most of my songs are at 44100 Hz,
> >> but there are some at 48000 Hz. If I start playing one of the 48000 Hz
> >> songs, all subsequent streams will be upsampled to 48000 Hz till I pause
> >> for >5 seconds.
> >>
> >> As you suggest, this will become less of a problem if we decrease the
> >> idle time required before suspend, and IMO this enough to make this a
> >> non-blocker.
> >
> > I wonder what happens if we set the timeout to zero for ALSA devices?
> Arun, I just tried with load-module module-suspend-on-idle timeout=0,
> and it seems to work fine on the HDAudio output. I was able to switch
> back and forth between 44.1 and 48kHz tracks without audible issues. I
> am not sure what happens with Rhythmbox if you enabled the cross-fade
> between tracks, most likely you would remain at the rate defined by
> the first song.

The xfade backend always resamples the stream to 44100 Hz (since it does
the mixing in GStreamer). Not much we can do there, but I am trying to
see if we can push the mixing to PulseAudio (we also need this to
maintain reasonable response time when setting a large tlength in
pulsesink to save power). Even if this is done, though, we're stuck with
the rate defined by the first song till a pause, but this is still not
so bad.

FWIW, the zero-length wait seems to work fine for me as well (also
HDAudio). A couple of things to consider if we do decide to go ahead
with this are are that:

* This will cause a pause on every seek in GStreamer as well (should be
fine in general since a seek causes a flush as well, but just something
to keep in mind while testing)

* We probably need to be more intelligent about resetting the alsa-sink
smoother since it tends to swing wildly for a while after resume (right
now it gets reset on every suspend/resume - probably makes more sense to
only reset if some minimum amount of time has passed)


More information about the pulseaudio-discuss mailing list