[PATCH 2/2] dsound: Send CaptureBuffer stop notification whenever stopping.

Shawn M. Chapla schapla at codeweavers.com
Mon Jan 11 19:41:23 CST 2021


Signed-off-by: Shawn M. Chapla <schapla at codeweavers.com>
---
 dlls/dsound/capture.c       | 7 ++++++-
 dlls/dsound/tests/capture.c | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c
index 10690f7df0d..02579ca064c 100644
--- a/dlls/dsound/capture.c
+++ b/dlls/dsound/capture.c
@@ -527,6 +527,8 @@ out:
     return DS_OK;
 }
 
+static void capture_CheckNotify(IDirectSoundCaptureBufferImpl *This, DWORD from, DWORD len);
+
 static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Stop(IDirectSoundCaptureBuffer8 *iface)
 {
     IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
@@ -544,8 +546,10 @@ static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Stop(IDirectSoundCaptureBuff
     TRACE("old This->device->state=%s\n",captureStateString[This->device->state]);
     if (This->device->state == STATE_CAPTURING)
 	This->device->state = STATE_STOPPING;
-    else if (This->device->state == STATE_STARTING)
+    else if (This->device->state == STATE_STARTING) {
 	This->device->state = STATE_STOPPED;
+        capture_CheckNotify(This->device->capture_buffer, 0, 0);
+    }
     TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
 
     if(This->device->client){
@@ -880,6 +884,7 @@ static HRESULT DSOUND_capture_data(DirectSoundCaptureDevice *device)
 
     if(device->state == STATE_STOPPING){
         device->state = STATE_STOPPED;
+        capture_CheckNotify(device->capture_buffer, 0, 0);
         return S_FALSE;
     }
 
diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c
index fb445794bd1..aa124ebd70d 100644
--- a/dlls/dsound/tests/capture.c
+++ b/dlls/dsound/tests/capture.c
@@ -427,7 +427,7 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
 
     /* wait for stop notification */
     rc = WaitForSingleObject(state.event[TIMESTAMP_CAPTURE_NTFCTNS], 3000);
-    todo_wine ok(rc == WAIT_OBJECT_0, "WaitForSingleObject failed: 0x%x\n", rc);
+    ok(rc == WAIT_OBJECT_0, "WaitForSingleObject failed: 0x%x\n", rc);
 
     rc=IDirectSoundCaptureBuffer_Stop(dscbo);
     ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
-- 
2.28.0




More information about the wine-devel mailing list