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).
so we would at least need a kernel api to enable silence-on-drain, which
user space could apply on device open.
this would be easy enough to do, but i really don't see a point in
adding that complexity, given that it should be always enabled, lest it
won't have much of a real-world impact.
fwiw, i just realized that the argument against touching the mmap'd
buffer is even weaker with the updated implementation, as it only clears
as much as user space would have to clear anyway (pedantically, i could
round it down to the end of a period rather than filling two whole
periods, if that's the bit that convinces you).
regards