Ken Thomases : dsound: Adjust for partial block before prepare-header and add-buffer steps.
Alexandre Julliard
julliard at winehq.org
Wed Mar 12 06:44:25 CDT 2008
Module: wine
Branch: master
Commit: 2de653552c02cd31f00480092583f1561b4180d4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2de653552c02cd31f00480092583f1561b4180d4
Author: Ken Thomases <ken at codeweavers.com>
Date: Wed Mar 12 02:05:56 2008 -0500
dsound: Adjust for partial block before prepare-header and add-buffer steps.
Otherwise, the wave-in driver(s) may copy incorrect data to internal structures.
---
dlls/dsound/capture.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c
index 0c74ef9..05ab805 100644
--- a/dlls/dsound/capture.c
+++ b/dlls/dsound/capture.c
@@ -1146,7 +1146,10 @@ IDirectSoundCaptureBufferImpl_Start(
for (c = 0; c < device->nrofpwaves; ++c) {
device->pwave[c].lpData = (char *)device->buffer + c * blocksize;
- device->pwave[c].dwBufferLength = blocksize;
+ if (c + 1 == device->nrofpwaves)
+ device->pwave[c].dwBufferLength = device->buflen - c * blocksize;
+ else
+ device->pwave[c].dwBufferLength = blocksize;
device->pwave[c].dwBytesRecorded = 0;
device->pwave[c].dwUser = (DWORD)device;
device->pwave[c].dwFlags = 0;
@@ -1167,8 +1170,6 @@ IDirectSoundCaptureBufferImpl_Start(
break;
}
}
- if (device->buflen % blocksize)
- device->pwave[device->nrofpwaves - 1].dwBufferLength = device->buflen % blocksize;
FillMemory(device->buffer, device->buflen, (device->pwfx->wBitsPerSample == 8) ? 128 : 0);
}
More information about the wine-cvs
mailing list