* Playing silence instead of pausing during underrun
@ 2008-09-04 15:04 Timur Tabi
2008-09-04 15:28 ` Jaroslav Kysela
0 siblings, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2008-09-04 15:04 UTC (permalink / raw)
To: ALSA development
If I understand it correctly, when ALSA detects an underrun during playback, it
throttles the driver by sending pause and resume commands.
It turns out that our hardware doesn't really like this. We're looking at
various solutions, but one proposal would be to keep the hardware running during
a pause, but just have it play silence instead. That is, ALSA keeps feeding
silence data during an underrun recovery.
Is there an easy way to do this in ALSA? Is there another driver that does this?
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Playing silence instead of pausing during underrun
2008-09-04 15:04 Playing silence instead of pausing during underrun Timur Tabi
@ 2008-09-04 15:28 ` Jaroslav Kysela
2008-09-04 16:04 ` Timur Tabi
0 siblings, 1 reply; 4+ messages in thread
From: Jaroslav Kysela @ 2008-09-04 15:28 UTC (permalink / raw)
To: Timur Tabi; +Cc: ALSA development
On Thu, 4 Sep 2008, Timur Tabi wrote:
> If I understand it correctly, when ALSA detects an underrun during
> playback, it throttles the driver by sending pause and resume commands.
>
> It turns out that our hardware doesn't really like this. We're looking
> at various solutions, but one proposal would be to keep the hardware
> running during a pause, but just have it play silence instead. That is,
> ALSA keeps feeding silence data during an underrun recovery.
>
> Is there an easy way to do this in ALSA? Is there another driver that
> does this?
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.
Jaroslav
-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Playing silence instead of pausing during underrun
2008-09-04 15:28 ` Jaroslav Kysela
@ 2008-09-04 16:04 ` Timur Tabi
2008-09-05 6:21 ` Takashi Iwai
0 siblings, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2008-09-04 16:04 UTC (permalink / raw)
To: Jaroslav Kysela; +Cc: ALSA development
On Thu, Sep 4, 2008 at 10:28 AM, Jaroslav Kysela <perex@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.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Playing silence instead of pausing during underrun
2008-09-04 16:04 ` Timur Tabi
@ 2008-09-05 6:21 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2008-09-05 6:21 UTC (permalink / raw)
To: Timur Tabi; +Cc: ALSA development
At Thu, 4 Sep 2008 11:04:55 -0500,
Timur Tabi wrote:
>
> On Thu, Sep 4, 2008 at 10:28 AM, Jaroslav Kysela <perex@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.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-05 6:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-04 15:04 Playing silence instead of pausing during underrun Timur Tabi
2008-09-04 15:28 ` Jaroslav Kysela
2008-09-04 16:04 ` Timur Tabi
2008-09-05 6:21 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.