Maarten Lankhorst : dsound: Fix IDirectSoundCaptureBuffer Start/Stop, with tests.
Alexandre Julliard
julliard at winehq.org
Fri Oct 19 13:33:54 CDT 2012
Module: wine
Branch: master
Commit: 21c45016034b48fc93356195993726d91153e7cf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=21c45016034b48fc93356195993726d91153e7cf
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Tue Oct 16 14:06:26 2012 +0200
dsound: Fix IDirectSoundCaptureBuffer Start/Stop, with tests.
---
dlls/dsound/capture.c | 6 ++++--
dlls/dsound/tests/capture.c | 24 +++++++++++++++---------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c
index 5336b59..1b004e6 100644
--- a/dlls/dsound/capture.c
+++ b/dlls/dsound/capture.c
@@ -493,13 +493,14 @@ static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start(IDirectSoundCaptureBuf
EnterCriticalSection(&(This->device->lock));
- This->flags = dwFlags;
- TRACE("old This->device->state=%s\n",captureStateString[This->device->state]);
if (This->device->state == STATE_STOPPED)
This->device->state = STATE_STARTING;
else if (This->device->state == STATE_STOPPING)
This->device->state = STATE_CAPTURING;
+ else
+ goto out;
TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
+ This->flags = dwFlags;
if (This->device->buffer)
FillMemory(This->device->buffer, This->device->buflen, (This->device->pwfx->wBitsPerSample == 8) ? 128 : 0);
@@ -511,6 +512,7 @@ static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start(IDirectSoundCaptureBuf
return hres;
}
+out:
LeaveCriticalSection(&This->device->lock);
TRACE("returning DS_OK\n");
diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c
index ba52818..2afd522 100644
--- a/dlls/dsound/tests/capture.c
+++ b/dlls/dsound/tests/capture.c
@@ -394,15 +394,18 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
ok(ref==0,"IDirectSoundNotify_Release(): has %d references, should have "
"0\n",ref);
- if (record) {
- rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING);
- ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
+ rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING);
+ ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
+
+ rc=IDirectSoundCaptureBuffer_Start(dscbo,0);
+ ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
- rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
- ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
- ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING),
- "GetStatus: bad status: %x\n",status);
+ rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
+ ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
+ ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING),
+ "GetStatus: bad status: %x\n",status);
+ if (record) {
/* wait for the notifications */
for (i = 0; i < (NOTIFICATIONS * 2); i++) {
rc=WaitForMultipleObjects(NOTIFICATIONS,state.event,FALSE,3000);
@@ -417,9 +420,12 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
break;
}
- rc=IDirectSoundCaptureBuffer_Stop(dscbo);
- ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
}
+ rc=IDirectSoundCaptureBuffer_Stop(dscbo);
+ ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
+
+ rc=IDirectSoundCaptureBuffer_Stop(dscbo);
+ ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
}
static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
More information about the wine-cvs
mailing list