]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ALSA: pcm: fix playback silence - use the actual new_hw_ptr for the threshold mode
authorJaroslav Kysela <perex@perex.cz>
Fri, 5 May 2023 15:52:39 +0000 (17:52 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 5 May 2023 16:23:49 +0000 (18:23 +0200)
commit2fbaa44a59887f9fd70c986f39c4ac9aebd0c8a1
tree8a6603e95047bfb92bd746ec92a5aaa329bae595
parentd7f5dd9790bbf9c7357672bafb1992ee7aadf45a
ALSA: pcm: fix playback silence - use the actual new_hw_ptr for the threshold mode

The snd_pcm_playback_hw_avail() function uses runtime->status->hw_ptr.
Unfortunately, in case when we call this function from snd_pcm_update_hw_ptr0(),
this variable contains the previous hardware pointer. Use the new_hw_ptr
argument to calculate hw_avail (filled samples by the user space) to
correct the threshold comparison.

The new_hw_ptr argument may also be set to ULONG_MAX which means the
initialization phase. In this case, use runtime->status->hw_ptr.

Suggested-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230505155244.2312199-2-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_lib.c