Make multimedia threads high priority.
This commit is contained in:
parent
c7bd5fb16d
commit
b2ba933fcf
|
@ -109,6 +109,7 @@ static DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
|
|||
WARN("Couldn't allocate thread for async command handling, sending synchronously\n");
|
||||
return MCI_SCAStarter(&sca);
|
||||
}
|
||||
SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
CloseHandle(handle);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -159,6 +159,7 @@ static DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
|
|||
WARN("Couldn't allocate thread for async command handling, sending synchonously\n");
|
||||
return MCI_SCAStarter(&sca);
|
||||
}
|
||||
SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
CloseHandle(handle);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -122,6 +122,7 @@ static DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
|
|||
WARN("Couldn't allocate thread for async command handling, sending synchonously\n");
|
||||
return MCI_SCAStarter(&sca);
|
||||
}
|
||||
SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
CloseHandle(handle);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1946,6 +1946,7 @@ LRESULT WINAPI mmThreadCreate16(FARPROC16 fpThreadAddr, LPHANDLE16 lpHndl, DWORD
|
|||
CloseHandle(lpMMThd->hEvent);
|
||||
ret = 2;
|
||||
} else {
|
||||
SetThreadPriority(lpMMThd->hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
TRACE("Got a nice thread hndl=%p id=0x%08lx\n", lpMMThd->hThread, lpMMThd->dwThreadID);
|
||||
ret = 0;
|
||||
}
|
||||
|
|
|
@ -471,6 +471,7 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSo
|
|||
wps->bLoop = (fdwSound & SND_LOOP) ? TRUE : FALSE;
|
||||
if ((handle = CreateThread(NULL, 0, proc_PlaySound, wps, 0, &id)) != 0) {
|
||||
wps->hThread = handle;
|
||||
SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2007,6 +2007,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||
if (!(dwFlags & WAVE_DIRECTSOUND)) {
|
||||
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
|
||||
if (wwo->hThread)
|
||||
SetThreadPriority(wwo->hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
|
||||
CloseHandle(wwo->hStartUpEvent);
|
||||
} else {
|
||||
|
@ -3474,6 +3476,8 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||
if (!(dwFlags & WAVE_DIRECTSOUND)) {
|
||||
wwi->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
|
||||
if (wwi->hThread)
|
||||
SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
WaitForSingleObject(wwi->hStartUpEvent, INFINITE);
|
||||
CloseHandle(wwi->hStartUpEvent);
|
||||
} else {
|
||||
|
|
|
@ -462,6 +462,7 @@ static DWORD midOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags)
|
|||
midiCloseSeq();
|
||||
return MMSYSERR_ERROR;
|
||||
}
|
||||
SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
TRACE("Created thread for midi-in\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -1208,6 +1208,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||
if (!(dwFlags & WAVE_DIRECTSOUND)) {
|
||||
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
|
||||
if (wwo->hThread)
|
||||
SetThreadPriority(wwo->hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
|
||||
CloseHandle(wwo->hStartUpEvent);
|
||||
} else {
|
||||
|
@ -1860,6 +1862,8 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||
if (!(dwFlags & WAVE_DIRECTSOUND)) {
|
||||
wwi->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
|
||||
if (wwi->hThread)
|
||||
SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
WaitForSingleObject(wwi->hStartUpEvent, INFINITE);
|
||||
CloseHandle(wwi->hStartUpEvent);
|
||||
} else {
|
||||
|
|
|
@ -894,6 +894,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||
if (!(dwFlags & WAVE_DIRECTSOUND)) {
|
||||
wwo->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
|
||||
if (wwo->hThread)
|
||||
SetThreadPriority(wwo->hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
WaitForSingleObject(wwo->hEvent, INFINITE);
|
||||
} else {
|
||||
wwo->hEvent = INVALID_HANDLE_VALUE;
|
||||
|
@ -1979,6 +1981,8 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||
|
||||
wwi->hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
wwi->hThread = CreateThread(NULL, 0, widRecorder, (LPVOID)(DWORD)wDevID, 0, &(wwi->dwThreadID));
|
||||
if (wwi->hThread)
|
||||
SetThreadPriority(wwi->hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
WaitForSingleObject(wwi->hEvent, INFINITE);
|
||||
|
||||
if (LIBAUDIOIO_NotifyClient(wDevID, WIM_OPEN, 0L, 0L) != MMSYSERR_NOERROR) {
|
||||
|
|
|
@ -956,6 +956,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
|
|||
if (!(dwFlags & WAVE_DIRECTSOUND)) {
|
||||
wwo->hStartUpEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
||||
wwo->hThread = CreateThread(NULL, 0, wodPlayer, (LPVOID)(DWORD)wDevID, 0, &(wwo->dwThreadID));
|
||||
if (wwo->hThread)
|
||||
SetThreadPriority(wwo->hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
WaitForSingleObject(wwo->hStartUpEvent, INFINITE);
|
||||
CloseHandle(wwo->hStartUpEvent);
|
||||
} else {
|
||||
|
|
|
@ -1786,6 +1786,7 @@ MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi
|
|||
midiStreamClose((HMIDISTRM)hMidiOut);
|
||||
return MMSYSERR_NOMEM;
|
||||
}
|
||||
SetThreadPriority(lpMidiStrm->hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
|
||||
/* wait for thread to have started, and for its queue to be created */
|
||||
{
|
||||
|
@ -2797,6 +2798,7 @@ MMRESULT WINAPI mmTaskCreate(LPTASKCALLBACK cb, HANDLE* ph, DWORD client)
|
|||
if (hEvent) CloseHandle(hEvent);
|
||||
return TASKERR_OUTOFMEMORY;
|
||||
}
|
||||
SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
if (ph) *ph = hEvent;
|
||||
CloseHandle(hThread);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue