https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ad1425593334fb740f1bae75f15cdc4e18976a31

commit ad1425593334fb740f1bae75f15cdc4e18976a31
Author:     Thamatip Chitpong <[email protected]>
AuthorDate: Wed Jun 14 07:30:42 2023 +0700
Commit:     Stanislav Motylkov <[email protected]>
CommitDate: Thu Jul 6 13:36:20 2023 +0300

    [WINESYNC][WINMM] Abort PlaySound in case of audio error
    
    Wine commit: ca37dbcfe6309fd7caad1f53f3b76773cd0278fa
    
    author: Jörg Höhle <[email protected]>
    Sat, 26 Mar 2011 06:36:47 +0000 (07:36 +0100)
    
    committer: Alexandre Julliard <[email protected]>
    Wed, 30 Mar 2011 11:28:04 +0000 (13:28 +0200)
---
 dll/win32/winmm/playsound.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dll/win32/winmm/playsound.c b/dll/win32/winmm/playsound.c
index 5bb2c31be4f..f6b2813d34d 100644
--- a/dll/win32/winmm/playsound.c
+++ b/dll/win32/winmm/playsound.c
@@ -335,7 +335,6 @@ static void CALLBACK PlaySound_Callback(HWAVEOUT hwo, UINT 
uMsg,
 static void PlaySound_WaitDone(struct playsound_data* s)
 {
     for (;;) {
-       ResetEvent(s->hEvent);
        if (InterlockedDecrement(&s->dwEventCount) >= 0) break;
        InterlockedIncrement(&s->dwEventCount);
 
@@ -511,17 +510,20 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
            if (count < 1) break;
            left -= count;
            waveHdr[index].dwBufferLength = count;
-           waveHdr[index].dwFlags &= ~WHDR_DONE;
            if (waveOutWrite(wps->hWave, &waveHdr[index], sizeof(WAVEHDR)) == 
MMSYSERR_NOERROR) {
                 index ^= 1;
                 PlaySound_WaitDone(&s);
             }
-            else FIXME("Couldn't play header\n");
+            else {
+                ERR("Aborting play loop, waveOutWrite error\n");
+                wps->bLoop = FALSE;
+                break;
+            }
        }
        bRet = TRUE;
     } while (wps->bLoop);
 
-    PlaySound_WaitDone(&s); /* for last buffer */
+    PlaySound_WaitDone(&s); /* to balance first buffer */
     waveOutReset(wps->hWave);
 
     waveOutUnprepareHeader(wps->hWave, &waveHdr[0], sizeof(WAVEHDR));

Reply via email to