Module: wine Branch: master Commit: 025e6650e4378771a4fd1a872bebfbfb2b2b72d7 URL: http://source.winehq.org/git/wine.git/?a=commit;h=025e6650e4378771a4fd1a872b...
Author: Andrew Eikum aeikum@codeweavers.com Date: Mon Apr 6 08:21:48 2015 -0500
wineoss.drv: Cap reported OSS fill level to expected level.
Some devices apparently return that the buffer contains an extra frame that we never wrote. We should account for that to avoid an integer underflow.
---
dlls/wineoss.drv/mmdevdrv.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index ccd5c86..d2a0c86 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -1412,6 +1412,12 @@ static void oss_write_data(ACImpl *This) }else in_oss_frames = (This->oss_bufsize_bytes - bi.bytes) / This->fmt->nBlockAlign;
+ if(in_oss_frames > This->in_oss_frames){ + TRACE("Capping reported frames from %u to %u\n", + in_oss_frames, This->in_oss_frames); + in_oss_frames = This->in_oss_frames; + } + write_limit = 0; while(write_limit + in_oss_frames < max_period * 3) write_limit += max_period;