]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: dsp: Avoid setting buffer that is too small.
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Sat, 16 Sep 2023 23:49:34 +0000 (08:49 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Sun, 17 Sep 2023 12:54:11 +0000 (21:54 +0900)
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>
winsup/cygwin/fhandler/dsp.cc

index 03c812a9cb8f2eadc99d69265272515f3f181f1e..97f3eaa2778602e9c02b700e788532bf62ce120b 100644 (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;
       }
This page took 0.029533 seconds and 5 git commands to generate.