Re: [PATCH alsa-lib 1/4] pcm: hw: setup explicit silencing for snd_pcm_drain by default

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

 



On 03. 05. 23 22:19, Oswald Buddenhagen wrote:
On Wed, May 03, 2023 at 01:20:37PM +0200, Oswald Buddenhagen wrote:
On Tue, May 02, 2023 at 01:50:07PM +0200, Jaroslav Kysela wrote:
+		 * or the next period wake up)
+		 */
+		sw_params.silence_threshold = pcm->buffer_size;
+		sw_params.silence_size = silence_size;

so at this point i got the thought "huh, that can exceed the buffer
size. is that ok?" ...
and yes, it is. but ...

the kernel doesn't check silence_threshold, so user space can trigger
the snd_BUG_ON() in snd_pcm_playback_silence(). whoops.
(yes, this predates my patch.)
i'm not sure what the best way to deal with this is. anyway, different
tree, different patch.

actually, that analysis is garbage, because i didn't look at enough
context. :}

the kernel _does_ check the values in snd_pcm_sw_params(), which means
that silence_size exceeding silence_threshold would lead to EINVAL, and
therefore silencing being broken. this will inevitably happen with small
buffer sizes, where the 1/10th sec extension dominates.

Yes, I overlooked this. Thanks. Fixed in:

https://github.com/alsa-project/alsa-lib/commit/58077e2f0d896ff848f3551518b1d9fc6c97d695

					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