Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: alsa-devel@alsa-project.org
Subject: Re: [PATCH 2/2] ALSA: pcm: auto-fill buffer with silence when draining playback
Date: Tue, 11 Apr 2023 18:50:19 +0200	[thread overview]
Message-ID: <ZDWPy9YbXWWOqaC+@ugly> (raw)
In-Reply-To: <6d6c5f3a-81bc-acf4-eb4d-229b581bbe8b@perex.cz>

On Tue, Apr 11, 2023 at 04:48:58PM +0200, Jaroslav Kysela wrote:
>You're using a hammer to fix a little issue.
>
yes, but at the time it seemed like a rather small hammer to me.

if large buffers are actually a thing (what for?), then the fill could 
be limited to two periods or something. it would make the code uglier, 
though.

>Which code does not fill the last period?
>
a lot, i imagine - doing that is rather counter-intuitive when using the 
write() access method.

also, just the last period is not enough, due to the fifo, and possibly 
delayed/lost irqs.

>>> the silencing is controlled using sw_params, so applications may
>>> request the silencing before drain.
>>>
>> yeah, they could, but they don't, and most won't ever.
>> 
>> you're arguing for not doing a very practical and simple change that
>> will fix a lot of user code at once, for the sake of preventing an
>> entirely hypothetical and implausible problem. that is not a good
>> trade-off.
>
>I'm arguing that we should not do anything extra with the buffers until 
>the application requests that.

>That's the clear API context.
>
no, it's not. you cannot assume this to be understood as the central 
guiding principle which trumps more immediate issues. people use an api 
to solve a specific problem, and they want to do that with the least 
effort possible. no-one is going to read the whole docu top to bottom 
and remember every caveat. if it appears to work, people will just call 
it a day, and that's exactly what will be the case with the use of DRAIN 
(one needs a somewhat specific configuration and content to even notice 
that there is a problem).

>If we allow modification of the PCM buffer, I think that we should:
>
>- Do not modify the buffer for drivers already working with the
>   appl_ptr data (end position) only.
>
i suppose that should be detected by the drain callback being set up?

>- Handle the situation with the large buffer; it may make sense
>   to change the "wait" operation from the end-of-period interrupt to time
>   scheduler and stop the drain more early when the end-of-valid data condition
>   is fulfilled.
>
i don't understand what you're asking for.

>- Increase the protocol version.
>
>But as I wrote, I would make those extensions configurable 
>(SNDRV_PCM_HW_PARAMS_DRAIN_ALLOW_SILENCE). It can be turned on by default.
>
i have no clue what would be involved in doing that. to me that sounds 
like overkill (solving a non-issue), and goes waaaay beyond what i 
expected to invest into this issue (really, i just wanted to verify that 
the emu10k1 fixes work, and accidentally discovered that there is a 
mid-layer issue that affects user space, as the pyalsaaudio lib i'm 
using doesn't handle it).

regards

  reply	other threads:[~2023-04-11 16:51 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 [this message]
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=ZDWPy9YbXWWOqaC+@ugly \
    --to=oswald.buddenhagen@gmx.de \
    --cc=alsa-devel@alsa-project.org \
    /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