[alsa-devel] Playing silence instead of pausing during underrun

Takashi Iwai tiwai at suse.de
Fri Sep 5 08:21:39 CEST 2008

At Thu, 4 Sep 2008 11:04:55 -0500,
Timur Tabi wrote:
> On Thu, Sep 4, 2008 at 10:28 AM, Jaroslav Kysela <perex at perex.cz> wrote:
> > Note that not all hardware supports pause, so just remove
> > SNDRV_PCM_INFO_PAUSE and all pause related code in the trigger callback
> > and let user space to do the full reinitialization.
> That's not what I'm talking about.  It doesn't matter if it's paused
> or stopped, when playback is paused/stopped, the hardware is disabled.
>  When the hardware is re-enabled, stale data in the hardware causes a
> popping sound.  Therefore, during underrun, the popping will not occur
> if the hardware is never disabled, but this requires either the driver
> or ALSA to pump silence data into the hardware.

Right now there is no common mechanism in the ALSA PCM core for that.
This might be a good thing to have such in the common place, though.
Or, we should reconsider the current mechanism of triggering.  There
are some other known problems regarding it.

For normal case to restart the stream, you can have a workaround in
prepare callback (prepare callback is always called before
start-trigger).  That is, if the stream was stopped in a certain
condition, set some flag.  In prepare callback, you first check this
flag, and fill silence if set, then clear the flag.  This doesn't work
for pause-resume, though.

The reason to put it in prepare callback is that trigger is supposed
to be atomic.


More information about the Alsa-devel mailing list