Commit 2de65355 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

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.
parent 0bb1eb72
......@@ -1146,6 +1146,9 @@ IDirectSoundCaptureBufferImpl_Start(
for (c = 0; c < device->nrofpwaves; ++c) {
device->pwave[c].lpData = (char *)device->buffer + c * 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;
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment