[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-patches
Subject:    OSS driver fix
From:       Eric Pouech <Eric.Pouech () wanadoo ! fr>
Date:       1999-10-30 20:49:20
[Download RAW message or body]

dlls/winmm/wineoss/audio.c
	fix (some) bad behavior with buffer underrun

-- 
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
["audio.diff" (text/plain)]

Index: dlls/winmm/wineoss/audio.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/wineoss/audio.c,v
retrieving revision 1.1
diff -u -r1.1 audio.c
--- dlls/winmm/wineoss/audio.c	1999/10/24 18:42:43	1.1
+++ dlls/winmm/wineoss/audio.c	1999/10/30 20:11:18
@@ -254,6 +254,8 @@
     
     /* get effective number of written bytes */
     if (!force) {
+	int	c;
+
 	if (ioctl(wwo->unixdev, SNDCTL_DSP_GETOPTR, &cinfo) == -1) {
 	    perror("ioctl SNDCTL_DSP_GETOPTR");
 	    wwo->hThread = 0;
@@ -261,7 +263,11 @@
 	    ExitThread(-1);
 	}
 	TRACE("Played %d bytes (played=%ld) on fd %d\n", cinfo.bytes, wwo->dwPlayed, wwo->unixdev);
-	wwo->wFragsUsedInQueue -= cinfo.bytes / wwo->dwFragmentSize - wwo->dwPlayed / wwo->dwFragmentSize;
+	c = cinfo.bytes / wwo->dwFragmentSize - wwo->dwPlayed / wwo->dwFragmentSize;
+	if (wwo->wFragsUsedInQueue > c)
+	    wwo->wFragsUsedInQueue -= c;
+	else
+	    wwo->wFragsUsedInQueue = 0;
 	wwo->dwPlayed = cinfo.bytes;
     }
     if (force || cinfo.bytes > wwo->dwNotifiedBytes) {

=========================================================================


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic