Fix a race condition where result could be read before set.
Fix test to use correct event in interactive mode.
This commit is contained in:
parent
03bb9b112b
commit
342d59f262
|
@ -371,6 +371,7 @@ static void wave_in_test_deviceIn(int device, int format, DWORD flags)
|
|||
HANDLE hevent;
|
||||
WAVEHDR frag;
|
||||
MMRESULT rc;
|
||||
DWORD res;
|
||||
|
||||
hevent=CreateEvent(NULL,FALSE,FALSE,NULL);
|
||||
ok(hevent!=NULL,"CreateEvent: error=%ld\n",GetLastError());
|
||||
|
@ -397,6 +398,8 @@ static void wave_in_test_deviceIn(int device, int format, DWORD flags)
|
|||
CloseHandle(hevent);
|
||||
return;
|
||||
}
|
||||
res=WaitForSingleObject(hevent,1000);
|
||||
ok(res==WAIT_OBJECT_0,"WaitForSingleObject failed for open\n");
|
||||
|
||||
ok(wfx.nChannels==win_formats[format][3] &&
|
||||
wfx.wBitsPerSample==win_formats[format][2] &&
|
||||
|
@ -423,16 +426,23 @@ static void wave_in_test_deviceIn(int device, int format, DWORD flags)
|
|||
|
||||
rc=waveInStart(win);
|
||||
ok(rc==MMSYSERR_NOERROR,"waveInStart: device=%d rc=%d\n",device,rc);
|
||||
WaitForSingleObject(hevent,INFINITE);
|
||||
res = WaitForSingleObject(hevent,1200);
|
||||
ok(res==WAIT_OBJECT_0,"WaitForSingleObject failed for header\n");
|
||||
|
||||
ok(frag.dwFlags&WHDR_DONE,"WHDR_DONE no set in frag.dwFlags\n");
|
||||
ok(frag.dwBytesRecorded==wfx.nAvgBytesPerSec,"frag.dwBytesRecorded=%ld, should=%ld\n",
|
||||
frag.dwBytesRecorded,wfx.nAvgBytesPerSec);
|
||||
}
|
||||
|
||||
rc=waveInUnprepareHeader(win, &frag, sizeof(frag));
|
||||
ok(rc==MMSYSERR_NOERROR,
|
||||
"waveInUnprepareHeader: device=%d rc=%d\n",device,rc);
|
||||
|
||||
waveInClose(win);
|
||||
res=WaitForSingleObject(hevent,1000);
|
||||
ok(res==WAIT_OBJECT_0,"WaitForSingleObject failed for close\n");
|
||||
free(frag.lpData);
|
||||
CloseHandle(hevent);
|
||||
waveInClose(win);
|
||||
}
|
||||
|
||||
static void wave_in_tests()
|
||||
|
|
|
@ -2717,9 +2717,10 @@ static DWORD CALLBACK widRecorder(LPVOID pmt)
|
|||
lpWaveHdr->dwFlags &= ~WHDR_INQUEUE;
|
||||
lpWaveHdr->dwFlags |= WHDR_DONE;
|
||||
|
||||
wwi->lpQueuePtr = lpNext;
|
||||
widNotifyClient(wwi, WIM_DATA, (DWORD)lpWaveHdr, 0);
|
||||
|
||||
wwi->lpQueuePtr = lpWaveHdr = lpNext;
|
||||
lpWaveHdr = lpNext;
|
||||
if (!lpNext && bytesRead) {
|
||||
/* before we give up, check for more header messages */
|
||||
while (OSS_PeekRingMessage(&wwi->msgRing, &msg, ¶m, &ev))
|
||||
|
|
Loading…
Reference in New Issue