Chris Robinson : quartz: Stop and free the dsound buffer when needed.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 19 07:02:08 CST 2007


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

Author: Chris Robinson <chris.kcat at gmail.com>
Date:   Sun Feb 18 09:59:41 2007 -0800

quartz: Stop and free the dsound buffer when needed.

---

 dlls/quartz/dsoundrender.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c
index 693d355..ee19148 100644
--- a/dlls/quartz/dsoundrender.c
+++ b/dlls/quartz/dsoundrender.c
@@ -166,6 +166,17 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, LPBYTE data,
     DWORD size2;
     DWORD play_pos,buf_free;
 
+    if (This->state != State_Running) {
+        DWORD state;
+        if (SUCCEEDED(IDirectSoundBuffer_GetStatus(This->dsbuffer, &state))) {
+            if (state & DSBSTATUS_PLAYING) {
+                IDirectSoundBuffer_Stop(This->dsbuffer);
+                This->started = FALSE;
+            }
+        }
+        return S_OK;
+    }
+
     while (1)
     {
         hr = IDirectSoundBuffer_GetCurrentPosition(This->dsbuffer, &play_pos, NULL);
@@ -390,6 +401,13 @@ static ULONG WINAPI DSoundRender_Release(IBaseFilter * iface)
         DeleteCriticalSection(&This->csFilter);
 	if (This->pClock)
             IReferenceClock_Release(This->pClock);
+
+        if (This->dsbuffer)
+            IDirectSoundBuffer_Release(This->dsbuffer);
+        This->dsbuffer = NULL;
+        if (This->dsound)
+            IDirectSound_Release(This->dsound);
+        This->dsound = NULL;
        
         IPin_Release(This->ppPins[0]);
         




More information about the wine-cvs mailing list