Re: [PATCH v2 2/2] ALSA: pcm: auto-fill buffer with silence when draining playback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux