From 322c7150b25ebd2c4c2bd4e3abbe0978f66f3737 Mon Sep 17 00:00:00 2001 From: Takashi Yano Date: Sun, 17 Sep 2023 08:49:34 +0900 Subject: [PATCH] Cygwin: dsp: Avoid setting buffer that is too small. The buffer size that is too small causes choppy sound. That is not practical at all. With this patch, the minimum value of the buffer size (i.e. fragstotal * fragsize) is restricted to 16384 bytes. Signed-off-by: Takashi Yano --- winsup/cygwin/fhandler/dsp.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winsup/cygwin/fhandler/dsp.cc b/winsup/cygwin/fhandler/dsp.cc index 03c812a9c..97f3eaa27 100644 --- a/winsup/cygwin/fhandler/dsp.cc +++ b/winsup/cygwin/fhandler/dsp.cc @@ -1430,6 +1430,8 @@ fhandler_dev_dsp::_ioctl (unsigned int cmd, void *buf) int *p = (int *) buf; fragstotal_ = min (*p >> 16, MAX_BLOCKS); fragsize_ = 1 << (*p & 0xffff); + while (fragsize_ * fragstotal_ < 16384) + fragsize_ *= 2; fragment_has_been_set = true; return 0; } -- 2.43.5