quartz: Some state changes fixes.

This commit is contained in:
Maarten Lankhorst 2008-04-28 16:35:53 -07:00 committed by Alexandre Julliard
parent 1ba8ece76e
commit 4e761d2613
1 changed files with 11 additions and 7 deletions

View File

@ -1145,7 +1145,6 @@ HRESULT OutputPin_CommitAllocator(OutputPin * This)
TRACE("(%p)->()\n", This); TRACE("(%p)->()\n", This);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
if (!This->custom_allocator)
{ {
if (!This->pin.pConnectedTo || !This->pMemInputPin) if (!This->pin.pConnectedTo || !This->pMemInputPin)
hr = VFW_E_NOT_CONNECTED; hr = VFW_E_NOT_CONNECTED;
@ -1164,6 +1163,7 @@ HRESULT OutputPin_CommitAllocator(OutputPin * This)
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
TRACE("--> %08x\n", hr);
return hr; return hr;
} }
@ -1474,10 +1474,6 @@ static void CALLBACK PullPin_Thread_Process(PullPin *This)
IMediaSample * pSample = NULL; IMediaSample * pSample = NULL;
ALLOCATOR_PROPERTIES allocProps; ALLOCATOR_PROPERTIES allocProps;
EnterCriticalSection(This->pin.pCritSec);
SetEvent(This->hEventStateChanged);
LeaveCriticalSection(This->pin.pCritSec);
hr = IMemAllocator_GetProperties(This->pAlloc, &allocProps); hr = IMemAllocator_GetProperties(This->pAlloc, &allocProps);
This->cbAlign = allocProps.cbAlign; This->cbAlign = allocProps.cbAlign;
@ -1502,6 +1498,10 @@ static void CALLBACK PullPin_Thread_Process(PullPin *This)
if (FAILED(hr)) if (FAILED(hr))
ERR("Request error: %x\n", hr); ERR("Request error: %x\n", hr);
EnterCriticalSection(This->pin.pCritSec);
SetEvent(This->hEventStateChanged);
LeaveCriticalSection(This->pin.pCritSec);
do do
{ {
DWORD_PTR dwUser; DWORD_PTR dwUser;
@ -1568,9 +1568,11 @@ static void CALLBACK PullPin_Thread_Process(PullPin *This)
/* Can't reset state to Sleepy here because that might race, instead PauseProcessing will do that for us /* Can't reset state to Sleepy here because that might race, instead PauseProcessing will do that for us
* Flush remaining samples * Flush remaining samples
*/ */
PullPin_Flush(This); TRACE("Almost done..\n");
if (This->fnDone) if (This->fnDone)
This->fnDone(This->pin.pUserData); This->fnDone(This->pin.pUserData);
PullPin_Flush(This);
TRACE("End: %08x, %d\n", hr, This->stop_playback); TRACE("End: %08x, %d\n", hr, This->stop_playback);
} }
@ -1706,6 +1708,9 @@ HRESULT PullPin_PauseProcessing(PullPin * This)
PullPin_WaitForStateChange(This, INFINITE); PullPin_WaitForStateChange(This, INFINITE);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
/* Faster! */
IAsyncReader_BeginFlush(This->pReader);
assert(!This->stop_playback); assert(!This->stop_playback);
assert(This->state == Req_Run|| This->state == Req_Sleepy); assert(This->state == Req_Run|| This->state == Req_Sleepy);
@ -1737,7 +1742,6 @@ HRESULT PullPin_StopProcessing(PullPin * This)
assert(WaitForSingleObject(This->thread_sleepy, 0) == WAIT_TIMEOUT); assert(WaitForSingleObject(This->thread_sleepy, 0) == WAIT_TIMEOUT);
ResetEvent(This->hEventStateChanged); ResetEvent(This->hEventStateChanged);
SetEvent(This->thread_sleepy); SetEvent(This->thread_sleepy);
return S_OK; return S_OK;
} }