From: Takashi Iwai <tiwai@suse.de>
To: Jaroslav Kysela <perex@perex.cz>
Cc: ALSA development <alsa-devel@alsa-project.org>,
Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Subject: Re: [PATCH 2/2] ALSA: pcm: auto-fill buffer with silence when draining playback
Date: Thu, 13 Apr 2023 07:42:06 +0200 [thread overview]
Message-ID: <871qkoxrrl.wl-tiwai@suse.de> (raw)
In-Reply-To: <54c16616-dee7-b50f-d612-82eef906d1df@perex.cz>
On Wed, 12 Apr 2023 21:59:28 +0200,
Jaroslav Kysela wrote:
>
> On 12. 04. 23 12:37, Takashi Iwai wrote:
> > On Wed, 12 Apr 2023 10:04:31 +0200,
> > Oswald Buddenhagen wrote:
> >>
> >> On Wed, Apr 12, 2023 at 09:54:54AM +0200, Takashi Iwai wrote:
> >>> I'm thinking whether we need to change anything in the kernel side for
> >>> this at all. Can't it be changed rather in alsa-lib side instead?
> >>>
> >> it could, but it would be a lot uglier. user space would have to do a
> >> "man-in-the-middle attack" on the data, while in the kernel we can
> >> just slightly modify the consumer. this would be particularly obvious
> >> in the case of write() access.
> >
> > But basically it'd be like fiddling sw_params temporarily for
> > draining, I suppose? And the "attack" here can be taken too
> > seriously; the whole PCM operation can be somehow interfered if a
> > process may have the access to the PCM device, and changing sw_params
> > itself must not introduce too much trouble.
>
> This looks like a sane proposal, but some drivers does not require the
> silencing at all, so we can probably skip this step for them (new
> SNDRV_PCM_INFO_PERFECT_DRAIN flag?).
Sure, we should apply it only conditionally. Also, we may skip the
workaround for applications accessing directly via mmap as default.
Also we may provide a flag in asoundrc config, if any, too.
The implementation in alsa-lib is more flexible in this regard.
> The other not-yet-discussed option is to just print an warning in
> alsa-lib that the residue samples may be played (when no silencing /
> period size align is used). Then introduce a new helper function to
> setup silencing for the drivers without new
> SNDRV_PCM_INFO_PERFECT_DRAIN flag set.
Hm, I don't think this would be useful. Spewing warnings are rather
annoying or confusing for end users, and I bet the old applications
wouldn't be fixed even with such annoyance.
thanks,
Takashi
next prev parent reply other threads:[~2023-04-13 5:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 20:12 [PATCH 1/2] ALSA: pcm: rewrite snd_pcm_playback_silence() Oswald Buddenhagen
2023-04-05 20:12 ` [PATCH 2/2] ALSA: pcm: auto-fill buffer with silence when draining playback Oswald Buddenhagen
2023-04-07 23:58 ` Jaroslav Kysela
2023-04-08 5:55 ` Takashi Iwai
2023-04-08 7:24 ` Oswald Buddenhagen
2023-04-11 11:09 ` Jaroslav Kysela
2023-04-11 13:57 ` Oswald Buddenhagen
2023-04-11 14:48 ` Jaroslav Kysela
2023-04-11 16:50 ` Oswald Buddenhagen
2023-04-11 17:23 ` Jaroslav Kysela
2023-04-12 7:54 ` Takashi Iwai
2023-04-12 8:04 ` Oswald Buddenhagen
2023-04-12 10:37 ` Takashi Iwai
2023-04-12 11:38 ` Oswald Buddenhagen
2023-04-12 19:59 ` Jaroslav Kysela
2023-04-13 5:42 ` Takashi Iwai [this message]
2023-04-13 10:16 ` Oswald Buddenhagen
2023-04-13 10:28 ` Takashi Iwai
2023-04-13 11:10 ` Oswald Buddenhagen
2023-04-13 12:06 ` Takashi Iwai
2023-04-13 14:59 ` Oswald Buddenhagen
2023-04-14 8:26 ` Takashi Iwai
2023-04-14 8:56 ` Oswald Buddenhagen
2023-04-14 9:28 ` Takashi Iwai
2023-04-06 14:53 ` [PATCH 1/2] ALSA: pcm: rewrite snd_pcm_playback_silence() Takashi Iwai
2023-04-11 10:47 ` Jaroslav Kysela
2023-04-12 10:33 ` Oswald Buddenhagen
2023-04-12 19:23 ` Jaroslav Kysela
2023-04-13 9:44 ` Oswald Buddenhagen
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=871qkoxrrl.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=oswald.buddenhagen@gmx.de \
--cc=perex@perex.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox