Commit 20547de0 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Patch the fragment size if it does not match the current sound

format. This saves us from triggering a kernel freeze on some OSS 2.4 + SoundBlaster 16 systems.
parent e7427e13
...@@ -1780,6 +1780,18 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) ...@@ -1780,6 +1780,18 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwo->dwWrittenTotal = 0; wwo->dwWrittenTotal = 0;
wwo->bNeedPost = TRUE; wwo->bNeedPost = TRUE;
TRACE("fd=%d fragstotal=%d fragsize=%d BufferSize=%ld\n",
wwo->ossdev->fd, info.fragstotal, info.fragsize, wwo->dwBufferSize);
if (wwo->dwFragmentSize % wwo->format.wf.nBlockAlign) {
ERR("Fragment doesn't contain an integral number of data blocks fragsize=%ld BlockAlign=%d\n",wwo->dwFragmentSize,wwo->format.wf.nBlockAlign);
/* Some SoundBlaster 16 cards return an incorrect (odd) fragment
* size for 16 bit sound. This will cause a system crash when we try
* to write just the specified odd number of bytes. So if we
* detect something is wrong we'd better fix it.
*/
wwo->dwFragmentSize-=wwo->dwFragmentSize % wwo->format.wf.nBlockAlign;
}
OSS_InitRingMessage(&wwo->msgRing); OSS_InitRingMessage(&wwo->msgRing);
wwo->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL); wwo->hStartUpEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
...@@ -1788,11 +1800,6 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags) ...@@ -1788,11 +1800,6 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
CloseHandle(wwo->hStartUpEvent); CloseHandle(wwo->hStartUpEvent);
wwo->hStartUpEvent = INVALID_HANDLE_VALUE; wwo->hStartUpEvent = INVALID_HANDLE_VALUE;
TRACE("fd=%d fragmentSize=%ld\n",
wwo->ossdev->fd, wwo->dwFragmentSize);
if (wwo->dwFragmentSize % wwo->format.wf.nBlockAlign)
ERR("Fragment doesn't contain an integral number of data blocks\n");
TRACE("wBitsPerSample=%u, nAvgBytesPerSec=%lu, nSamplesPerSec=%lu, nChannels=%u nBlockAlign=%u!\n", TRACE("wBitsPerSample=%u, nAvgBytesPerSec=%lu, nSamplesPerSec=%lu, nChannels=%u nBlockAlign=%u!\n",
wwo->format.wBitsPerSample, wwo->format.wf.nAvgBytesPerSec, wwo->format.wBitsPerSample, wwo->format.wf.nAvgBytesPerSec,
wwo->format.wf.nSamplesPerSec, wwo->format.wf.nChannels, wwo->format.wf.nSamplesPerSec, wwo->format.wf.nChannels,
......
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