dsound: Correctly update buflen.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
371c43550c
commit
3076192e7d
|
@ -250,18 +250,18 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device, WAVEFORMATEX *wfx,
|
||||||
}
|
}
|
||||||
FillMemory(newbuf, new_buflen, (wfx->wBitsPerSample == 8) ? 128 : 0);
|
FillMemory(newbuf, new_buflen, (wfx->wBitsPerSample == 8) ? 128 : 0);
|
||||||
} else if (!mixfloat) {
|
} else if (!mixfloat) {
|
||||||
DWORD alloc_len = frames * sizeof(float);
|
new_buflen = frames * sizeof(float);
|
||||||
|
|
||||||
if (device->buffer)
|
if (device->buffer)
|
||||||
newbuf = HeapReAlloc(GetProcessHeap(), 0, device->buffer, alloc_len);
|
newbuf = HeapReAlloc(GetProcessHeap(), 0, device->buffer, new_buflen);
|
||||||
else
|
else
|
||||||
newbuf = HeapAlloc(GetProcessHeap(), 0, alloc_len);
|
newbuf = HeapAlloc(GetProcessHeap(), 0, new_buflen);
|
||||||
|
|
||||||
if (!newbuf) {
|
if (!newbuf) {
|
||||||
ERR("failed to allocate primary buffer\n");
|
ERR("failed to allocate primary buffer\n");
|
||||||
return DSERR_OUTOFMEMORY;
|
return DSERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
FillMemory(newbuf, alloc_len, (wfx->wBitsPerSample == 8) ? 128 : 0);
|
FillMemory(newbuf, new_buflen, (wfx->wBitsPerSample == 8) ? 128 : 0);
|
||||||
} else {
|
} else {
|
||||||
HeapFree(GetProcessHeap(), 0, device->buffer);
|
HeapFree(GetProcessHeap(), 0, device->buffer);
|
||||||
newbuf = NULL;
|
newbuf = NULL;
|
||||||
|
|
Loading…
Reference in New Issue