4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-18 23:12:15 +08:00

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 <takashi.yano@nifty.ne.jp>
This commit is contained in:
Takashi Yano 2023-09-17 08:49:34 +09:00
parent 8484773f47
commit 322c7150b2

View File

@ -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;
}