Andrew Eikum : dsound: Don't send notify events before played range.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Dec 19 16:18:34 CST 2014


Module: wine
Branch: master
Commit: 29d1ccc7e22c4e00c6212b4b15831bf5dc2071cd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=29d1ccc7e22c4e00c6212b4b15831bf5dc2071cd

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Fri Dec 19 09:10:46 2014 -0600

dsound: Don't send notify events before played range.

---

 dlls/dsound/mixer.c        | 18 +++++++++++-------
 dlls/dsound/tests/dsound.c |  5 +----
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
index 8d6b379..0fae20e 100644
--- a/dlls/dsound/mixer.c
+++ b/dlls/dsound/mixer.c
@@ -223,16 +223,20 @@ void DSOUND_CheckEvent(const IDirectSoundBufferImpl *dsb, DWORD playpos, int len
         }
     }
 
-    TRACE("Not stopped: first notify: %u (%u), range: [%u,%u)\n", first,
-            dsb->notifies[check].dwOffset, playpos, (playpos + len) % dsb->buflen);
+    TRACE("Not stopped: first notify: %u (%u), left notify: %u (%u), range: [%u,%u)\n",
+            first, dsb->notifies[first].dwOffset,
+            left, dsb->notifies[left].dwOffset,
+            playpos, (playpos + len) % dsb->buflen);
 
     /* send notifications in range */
-    for(check = left; check < dsb->nrofnotifies; ++check){
-        if(dsb->notifies[check].dwOffset >= playpos + len)
-            break;
+    if(dsb->notifies[left].dwOffset >= playpos){
+        for(check = left; check < dsb->nrofnotifies; ++check){
+            if(dsb->notifies[check].dwOffset >= playpos + len)
+                break;
 
-        TRACE("Signalling %p (%u)\n", dsb->notifies[check].hEventNotify, dsb->notifies[check].dwOffset);
-        SetEvent(dsb->notifies[check].hEventNotify);
+            TRACE("Signalling %p (%u)\n", dsb->notifies[check].hEventNotify, dsb->notifies[check].dwOffset);
+            SetEvent(dsb->notifies[check].hEventNotify);
+        }
     }
 
     if(playpos + len > dsb->buflen){
diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index 1df7ce4..e5a9110 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -1532,10 +1532,9 @@ static void test_notifications(LPGUID lpGuid)
     rc = IDirectSoundBuffer_QueryInterface(buf, &IID_IDirectSoundNotify, (void**)&buf_notif);
     ok(rc == DS_OK, "QueryInterface(IID_IDirectSoundNotify): %08x\n", rc);
 
-    /* create notifications at each end of the buffer */
     notifies[0].dwOffset = 0;
     handles[0] = notifies[0].hEventNotify = CreateEventW(NULL, FALSE, FALSE, NULL);
-    notifies[1].dwOffset = bufdesc.dwBufferBytes - 1;
+    notifies[1].dwOffset = bufdesc.dwBufferBytes / 2;
     handles[1] = notifies[1].hEventNotify = CreateEventW(NULL, FALSE, FALSE, NULL);
 
     rc = IDirectSoundNotify_SetNotificationPositions(buf_notif, 2, notifies);
@@ -1550,8 +1549,6 @@ static void test_notifications(LPGUID lpGuid)
     for(cycles = 0; cycles < 6 /* 1.5s */; ++cycles){
         DWORD wait;
 
-        /* since the notifications are on opposite ends of the entire buffer,
-         * they should arrive well-ordered in an alternating sequence. */
         wait = WaitForMultipleObjects(2, handles, FALSE, 1000);
         ok(wait <= WAIT_OBJECT_0 + 1 && wait - WAIT_OBJECT_0 == expect,
            "Got unexpected notification order or timeout: %u\n", wait);




More information about the wine-cvs mailing list