From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: Jaroslav Kysela <perex@perex.cz>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>
Subject: Re: [PATCH 2/2] ALSA: pcm: auto-fill buffer with silence when draining playback
Date: Sat, 8 Apr 2023 09:24:58 +0200 [thread overview]
Message-ID: <ZDEWyjdVE2IocpGY@ugly> (raw)
In-Reply-To: <3d75c103-7e94-e6a1-7f3d-7f957c33cddc@perex.cz>
On Sat, Apr 08, 2023 at 01:58:21AM +0200, Jaroslav Kysela wrote:
>On 05. 04. 23 22:12, 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. This patch makes it work out of the box.
>>
>I think that it was really bad decision to apply this patch without a
>broader discussion.
>When we designed the API, we knew about described problems and we
>decided to keep this up to applications.
>
i ran into no documentation of either the problems nor the decisions and
their implications for the user.
>The silencing may not help in all cases where the PCM samples ends with
>a high volume.
>
that would just create a slight crack, which isn't any different from a
"regular" sudden stop.
> A volume ramping should be used and it's an application job.
>
imo, that entirely misses the point - the volume is most likely already
zero at the end of the buffer. that doesn't mean that it's ok to play
the samples again where the volume might not be *quite* zero yet.
>Also, silencing touches the DMA buffer which may not be desired.
>
hypothetically, yes. but practically? why would anyone want to play the
same samples after draining? draining is most likely followed by closing
the device. and even if not, in most cases (esp. where draining would
actually make sense) one wouldn't play a fixed pattern that could be
just re-used, so one would have to re-fill the buffer prior to starting
again anyway. never mind the effort necessary to track the state of the
buffer instead of just re-filling it. so for all practical purposes,
already played samples can be considered undefined data and thus safe to
overwrite.
>And lastly drivers can handle draining correctly (stop at the exact
>position - see substream->ops->trigger with SNDRV_PCM_TRIGGER_DRAIN
>argument).
>
yeah. hypothetically. afaict, there is exactly one driver which supports
this. most (older) hardware wouldn't even have the capability to do such
precise timing without external help.
On Sat, Apr 08, 2023 at 07:55:48AM +0200, Takashi Iwai wrote:
>Applying the silencing blindly might be an overkill, indeed, although
>this could be seen as an easy solution. Let's see.
>
i don't think that "overkill" is right here. someone has to do the
silencing for draining to be useful at all, and so the question is only
who that should be. my argument is that not auto-silencing is
*extremely* unexpected, and thus just bad api. i'm pretty certain that
about 99% of the usages of DRAIN start out missing this, and most never
get fixed.
imo, if any api is added, it should be to opt *out* of auto-silencing.
but i don't think this makes any sense; there would be ~zero users of
this ever.
regards
next prev parent reply other threads:[~2023-04-08 7:26 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 [this message]
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
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=ZDEWyjdVE2IocpGY@ugly \
--to=oswald.buddenhagen@gmx.de \
--cc=alsa-devel@alsa-project.org \
--cc=perex@perex.cz \
--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.