All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: [PATCH v2 2/2] ALSA: pcm: auto-fill buffer with silence when draining playback
Date: Fri, 21 Apr 2023 15:29:38 +0200	[thread overview]
Message-ID: <bb342e84-b468-8adc-6688-88da2c857da1@perex.cz> (raw)
In-Reply-To: <ZEJfyzFXVuLHPs+S@ugly>

On 21. 04. 23 12:04, Oswald Buddenhagen wrote:
> On Fri, Apr 21, 2023 at 11:33:35AM +0200, Jaroslav Kysela wrote:
>> On 20. 04. 23 13:33, Oswald Buddenhagen wrote:
>>> Draining will always playback somewhat beyond the end of the filled
>>> buffer. This would produce artifacts if the user did not set up the
>>> auto-silencing machinery, which is an extremely easy mistake to make, as
>>> the API strongly suggests convenient fire-and-forget semantics. This
>>> patch makes it work out of the box.
>>
>> NACK. The initial implementation should be put to alsa-lib as discussed.
>>
> as discussed, a user-space only implementation based on the current
> kernel api is not reasonable:
> it could either enable auto-silencing on device open (which would be
> unreasonably expensive) or it could enable it on drain (and disable it
> once draining is done, which would be unreasonably complex due to
> needing to handle asynchronous draining completion).

I doubt. We should consider all solutions. The drain ends with the SETUP 
state, thus the application must call prepare again. We can restore the 
sw_params there for all types of i/o access (if the app does not reset 
sw_params itself). We can just set the silence_size (sw_params) in 
snd_pcm_hw_drain() and it's all.

Also, an interrupt can be "lost" or "merged" only for the small periods where 
the system is not able to handle the fast interrupts. For large periods, we 
should not assume that any of the interrupt is lost. Otherwise, it would break 
many things and the driver is really broken in this case. So the drain fill 
size should be updated for the big periods like "fill_align_to_last_period + 
100ms" or so.

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.


  reply	other threads:[~2023-04-21 13:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 11:33 [PATCH v2 1/2] ALSA: pcm: rewrite snd_pcm_playback_silence() Oswald Buddenhagen
2023-04-20 11:33 ` [PATCH v2 2/2] ALSA: pcm: auto-fill buffer with silence when draining playback Oswald Buddenhagen
2023-04-21  9:33   ` Jaroslav Kysela
2023-04-21 10:04     ` Oswald Buddenhagen
2023-04-21 13:29       ` Jaroslav Kysela [this message]
2023-04-21  9:20 ` [PATCH v2 1/2] ALSA: pcm: rewrite snd_pcm_playback_silence() Jaroslav Kysela
2023-04-21 11:10 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb342e84-b468-8adc-6688-88da2c857da1@perex.cz \
    --to=perex@perex.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=oswald.buddenhagen@gmx.de \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.