diff --git a/dlls/winmm/mciavi/mciavi.c b/dlls/winmm/mciavi/mciavi.c index cff2650d1d2..e3336f287fc 100644 --- a/dlls/winmm/mciavi/mciavi.c +++ b/dlls/winmm/mciavi/mciavi.c @@ -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; } diff --git a/dlls/winmm/mciseq/mcimidi.c b/dlls/winmm/mciseq/mcimidi.c index b00e9afba17..644bc27a2ef 100644 --- a/dlls/winmm/mciseq/mcimidi.c +++ b/dlls/winmm/mciseq/mcimidi.c @@ -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; } diff --git a/dlls/winmm/mciwave/mciwave.c b/dlls/winmm/mciwave/mciwave.c index 25492f91f55..d6eb2eab253 100644 --- a/dlls/winmm/mciwave/mciwave.c +++ b/dlls/winmm/mciwave/mciwave.c @@ -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; } diff --git a/dlls/winmm/mmsystem.c b/dlls/winmm/mmsystem.c index 1b6acaf5072..beba03fa067 100644 --- a/dlls/winmm/mmsystem.c +++ b/dlls/winmm/mmsystem.c @@ -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; } diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c index 1a68f3ca74a..a97e9967feb 100644 --- a/dlls/winmm/playsound.c +++ b/dlls/winmm/playsound.c @@ -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; } } diff --git a/dlls/winmm/winealsa/audio.c b/dlls/winmm/winealsa/audio.c index eb4852a8d58..b2cea26199c 100644 --- a/dlls/winmm/winealsa/audio.c +++ b/dlls/winmm/winealsa/audio.c @@ -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 { diff --git a/dlls/winmm/winealsa/midi.c b/dlls/winmm/winealsa/midi.c index 23a41c299c0..b689bd985e1 100644 --- a/dlls/winmm/winealsa/midi.c +++ b/dlls/winmm/winealsa/midi.c @@ -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"); } diff --git a/dlls/winmm/winearts/audio.c b/dlls/winmm/winearts/audio.c index 85725ceab09..486642f7995 100644 --- a/dlls/winmm/winearts/audio.c +++ b/dlls/winmm/winearts/audio.c @@ -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 { diff --git a/dlls/winmm/wineaudioio/audio.c b/dlls/winmm/wineaudioio/audio.c index 3357f00ec77..4c420a7b22b 100644 --- a/dlls/winmm/wineaudioio/audio.c +++ b/dlls/winmm/wineaudioio/audio.c @@ -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) { diff --git a/dlls/winmm/winenas/audio.c b/dlls/winmm/winenas/audio.c index 91ecb5388f9..6c2a9449b73 100644 --- a/dlls/winmm/winenas/audio.c +++ b/dlls/winmm/winenas/audio.c @@ -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 { diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c index 37344ae3f90..6bb2bd12451 100644 --- a/dlls/winmm/winmm.c +++ b/dlls/winmm/winmm.c @@ -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;