quartz: Stop DSound buffer playback when the filter is paused or
stopped, not the next time it's processed
Chris Robinson
chris.kcat at gmail.com
Sat Mar 10 06:11:10 CST 2007
-------------- next part --------------
From 6e048991acd4021e1c752b842fde747b69d04bf4 Mon Sep 17 00:00:00 2001
From: Chris Robinson <chris.kcat at gmail.com>
Date: Sat, 10 Mar 2007 04:09:43 -0800
Subject: [PATCH] quartz: Stop DSound buffer playback when the filter is paused or stopped, not the next time it's processed
---
dlls/quartz/dsoundrender.c | 46 +++++++++++++++++++++++++++++++------------
1 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c
index 0eb22da..28757f2 100644
--- a/dlls/quartz/dsoundrender.c
+++ b/dlls/quartz/dsoundrender.c
@@ -166,17 +166,6 @@ 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);
@@ -241,6 +230,9 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample)
HRESULT hr;
TRACE("%p %p\n", iface, pSample);
+
+ if (This->state != State_Running)
+ return VFW_E_WRONG_STATE;
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
if (FAILED(hr))
@@ -453,7 +445,21 @@ static HRESULT WINAPI DSoundRender_Stop(IBaseFilter * iface)
EnterCriticalSection(&This->csFilter);
{
- This->state = State_Stopped;
+ DWORD state = 0;
+ if (This->dsbuffer)
+ {
+ hr = IDirectSoundBuffer_GetStatus(This->dsbuffer, &state);
+ if (SUCCEEDED(hr))
+ {
+ if (state & DSBSTATUS_PLAYING)
+ hr = IDirectSoundBuffer_Stop(This->dsbuffer);
+ }
+ }
+ if (SUCCEEDED(hr))
+ {
+ This->started = FALSE;
+ This->state = State_Stopped;
+ }
}
LeaveCriticalSection(&This->csFilter);
@@ -469,7 +475,21 @@ static HRESULT WINAPI DSoundRender_Pause(IBaseFilter * iface)
EnterCriticalSection(&This->csFilter);
{
- This->state = State_Paused;
+ DWORD state = 0;
+ if (This->dsbuffer)
+ {
+ hr = IDirectSoundBuffer_GetStatus(This->dsbuffer, &state);
+ if (SUCCEEDED(hr))
+ {
+ if (state & DSBSTATUS_PLAYING)
+ hr = IDirectSoundBuffer_Stop(This->dsbuffer);
+ }
+ }
+ if (SUCCEEDED(hr))
+ {
+ This->started = FALSE;
+ This->state = State_Paused;
+ }
}
LeaveCriticalSection(&This->csFilter);
--
1.4.4.4
More information about the wine-patches
mailing list