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. Rather than figuring out the right threshold (which is one period plus the card-specific FIFO size plus some IRQ jitter), we use "top-up" mode. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@xxxxxx>
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. The silencing may not help in all cases where the PCM samples ends with a high volume. A volume ramping should be used and it's an application job. Also, silencing touches the DMA buffer which may not be desired. And lastly drivers can handle draining correctly (stop at the exact position - see substream->ops->trigger with SNDRV_PCM_TRIGGER_DRAIN argument).
I would create a new API extension for this (new ioctl or sw_params flag), but the default behaviour should be retained.
I will try to review the first patch too, but my time is limited over Easter. Jaroslav -- Jaroslav Kysela <perex@xxxxxxxx> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.