Commit 6a32d2ce authored by Hidenori Takeshima's avatar Hidenori Takeshima Committed by Alexandre Julliard

Fixed some deadlocks.

parent b5cb1a34
......@@ -1083,7 +1083,7 @@ HRESULT QUARTZ_CreateAsyncSourcePin(
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin,
pcsPin, NULL,
&pFilter->basefilter,
pwszPinName,
TRUE,
......
......@@ -663,6 +663,8 @@ static void QUARTZ_DestroyAudioRenderer(IUnknown* punk)
CAudioRendererImpl_UninitIBasicAudio(This);
CBaseFilterImpl_UninitIBaseFilter(&This->basefilter);
DeleteCriticalSection( &This->m_csReceive );
}
HRESULT QUARTZ_CreateAudioRenderer(IUnknown* punkOuter,void** ppobj)
......@@ -712,9 +714,12 @@ HRESULT QUARTZ_CreateAudioRenderer(IUnknown* punkOuter,void** ppobj)
This->unk.dwEntries = sizeof(FilterIFEntries)/sizeof(FilterIFEntries[0]);
This->unk.pOnFinalRelease = QUARTZ_DestroyAudioRenderer;
InitializeCriticalSection( &This->m_csReceive );
hr = QUARTZ_CreateAudioRendererPin(
This,
&This->basefilter.csFilter,
&This->m_csReceive,
&This->pPin );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CompList_AddComp(
......@@ -764,12 +769,13 @@ static void QUARTZ_DestroyAudioRendererPin(IUnknown* punk)
HRESULT QUARTZ_CreateAudioRendererPin(
CAudioRendererImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CAudioRendererPinImpl** ppPin)
{
CAudioRendererPinImpl* This = NULL;
HRESULT hr;
TRACE("(%p,%p,%p)\n",pFilter,pcsPin,ppPin);
TRACE("(%p,%p,%p,%p)\n",pFilter,pcsPin,pcsPinReceive,ppPin);
This = (CAudioRendererPinImpl*)
QUARTZ_AllocObj( sizeof(CAudioRendererPinImpl) );
......@@ -782,7 +788,7 @@ HRESULT QUARTZ_CreateAudioRendererPin(
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin,
pcsPin, pcsPinReceive,
&pFilter->basefilter,
QUARTZ_AudioRenderPin_Name,
FALSE,
......
......@@ -35,6 +35,7 @@ struct CAudioRendererImpl
CSeekingPassThru* pSeekPass;
CAudioRendererPinImpl* pPin;
CRITICAL_SECTION m_csReceive;
BOOL m_fInFlush;
/* for waveOut */
......@@ -66,6 +67,7 @@ HRESULT QUARTZ_CreateAudioRenderer(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateAudioRendererPin(
CAudioRendererImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CAudioRendererPinImpl** ppPin);
......
......@@ -85,6 +85,7 @@ typedef struct CPinBaseImpl
ULONG cAcceptTypes;
CRITICAL_SECTION* pcsPin;
CRITICAL_SECTION* pcsPinReceive;
CBaseFilterImpl* pFilter;
IPin* pPinConnectedTo;
IMemInputPin* pMemInputPinConnectedTo;
......@@ -138,6 +139,7 @@ struct CBasePinHandlers
HRESULT CPinBaseImpl_InitIPin(
CPinBaseImpl* This, IUnknown* punkControl,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CBaseFilterImpl* pFilter, LPCWSTR pwszId,
BOOL bOutput,
const CBasePinHandlers* pHandlers );
......
......@@ -488,10 +488,10 @@ CPinBaseImpl_fnEndOfStream(IPin* iface)
if ( This->bOutput )
return E_UNEXPECTED;
EnterCriticalSection( This->pcsPin );
EnterCriticalSection( This->pcsPinReceive );
if ( This->pHandlers->pEndOfStream != NULL )
hr = This->pHandlers->pEndOfStream(This);
LeaveCriticalSection( This->pcsPin );
LeaveCriticalSection( This->pcsPinReceive );
return hr;
}
......@@ -512,6 +512,9 @@ CPinBaseImpl_fnBeginFlush(IPin* iface)
hr = This->pHandlers->pBeginFlush(This);
LeaveCriticalSection( This->pcsPin );
EnterCriticalSection( This->pcsPinReceive );
LeaveCriticalSection( This->pcsPinReceive );
return hr;
}
......@@ -585,6 +588,7 @@ static ICOM_VTABLE(IPin) ipin =
HRESULT CPinBaseImpl_InitIPin(
CPinBaseImpl* This, IUnknown* punkControl,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CBaseFilterImpl* pFilter, LPCWSTR pwszId,
BOOL bOutput,
const CBasePinHandlers* pHandlers )
......@@ -608,6 +612,7 @@ HRESULT CPinBaseImpl_InitIPin(
This->pmtAcceptTypes = NULL;
This->cAcceptTypes = 0;
This->pcsPin = pcsPin;
This->pcsPinReceive = pcsPinReceive;
This->pFilter = pFilter;
This->pPinConnectedTo = NULL;
This->pMemInputPinConnectedTo = NULL;
......@@ -766,10 +771,10 @@ CMemInputPinBaseImpl_fnReceive(IMemInputPin* iface,IMediaSample* pSample)
TRACE("(%p)->(%p)\n",This,pSample);
EnterCriticalSection( This->pPin->pcsPin );
EnterCriticalSection( This->pPin->pcsPinReceive );
if ( This->pPin->pHandlers->pReceive != NULL )
hr = This->pPin->pHandlers->pReceive(This->pPin,pSample);
LeaveCriticalSection( This->pPin->pcsPin );
LeaveCriticalSection( This->pPin->pcsPinReceive );
return hr;
}
......
......@@ -174,7 +174,7 @@ HRESULT QUARTZ_MediaSubType_FromBitmap(
if ( pbi->biPlanes == 1 && pbi->biHeight > 0 &&
pbi->biBitCount == 8 )
{
QUARTZ_MediaSubType_FromFourCC( psubtype, mmioFOURCC('M','R','L','E') );
QUARTZ_MediaSubType_FromFourCC( psubtype, 1 );
hr = S_OK;
}
break;
......@@ -182,7 +182,7 @@ HRESULT QUARTZ_MediaSubType_FromBitmap(
if ( pbi->biPlanes == 1 && pbi->biHeight > 0 &&
pbi->biBitCount == 4 )
{
QUARTZ_MediaSubType_FromFourCC( psubtype, mmioFOURCC('M','R','L','E') );
QUARTZ_MediaSubType_FromFourCC( psubtype, 2 );
hr = S_OK;
}
break;
......
......@@ -1115,7 +1115,7 @@ HRESULT QUARTZ_CreateParserInPin(
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin,
pcsPin, NULL,
&pFilter->basefilter,
pwszPinName,
FALSE,
......@@ -1217,7 +1217,7 @@ HRESULT QUARTZ_CreateParserOutPin(
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin,
pcsPin, NULL,
&pFilter->basefilter,
pwszPinName,
TRUE,
......
......@@ -129,9 +129,9 @@ VIDREN_WndProc(
{
case WM_PAINT:
TRACE("WM_PAINT begin\n");
EnterCriticalSection( &This->m_csSample );
EnterCriticalSection( &This->m_csReceive );
VIDREN_OnPaint( This, hwnd );
LeaveCriticalSection( &This->m_csSample );
LeaveCriticalSection( &This->m_csReceive );
TRACE("WM_PAINT end\n");
return 0;
case WM_CLOSE:
......@@ -320,9 +320,9 @@ static HRESULT CVideoRendererImpl_OnInactive( CBaseFilterImpl* pImpl )
FIXME( "(%p)\n", This );
EnterCriticalSection( &This->m_csSample );
EnterCriticalSection( &This->m_csReceive );
This->m_bSampleIsValid = FALSE;
LeaveCriticalSection( &This->m_csSample );
LeaveCriticalSection( &This->m_csReceive );
return NOERROR;
}
......@@ -485,11 +485,9 @@ static HRESULT CVideoRendererPinImpl_Receive( CPinBaseImpl* pImpl, IMediaSample*
return NOERROR;
}
EnterCriticalSection( &This->pRender->m_csSample );
memcpy(This->pRender->m_pSampleData,pData,lLength);
This->pRender->m_bSampleIsValid = TRUE;
PostMessageA( hwnd, VIDRENMSG_UPDATE, 0, 0 );
LeaveCriticalSection( &This->pRender->m_csSample );
return NOERROR;
}
......@@ -525,9 +523,9 @@ static HRESULT CVideoRendererPinImpl_BeginFlush( CPinBaseImpl* pImpl )
FIXME( "(%p)\n", This );
This->pRender->m_fInFlush = TRUE;
EnterCriticalSection( &This->pRender->m_csSample );
EnterCriticalSection( &This->pRender->m_csReceive );
This->pRender->m_bSampleIsValid = FALSE;
LeaveCriticalSection( &This->pRender->m_csSample );
LeaveCriticalSection( &This->pRender->m_csReceive );
return NOERROR;
}
......@@ -631,7 +629,7 @@ static void QUARTZ_DestroyVideoRenderer(IUnknown* punk)
CVideoRendererImpl_UninitIVideoWindow(This);
CBaseFilterImpl_UninitIBaseFilter(&This->basefilter);
DeleteCriticalSection( &This->m_csSample );
DeleteCriticalSection( &This->m_csReceive );
}
HRESULT QUARTZ_CreateVideoRenderer(IUnknown* punkOuter,void** ppobj)
......@@ -694,11 +692,12 @@ HRESULT QUARTZ_CreateVideoRenderer(IUnknown* punkOuter,void** ppobj)
This->unk.dwEntries = sizeof(FilterIFEntries)/sizeof(FilterIFEntries[0]);
This->unk.pOnFinalRelease = QUARTZ_DestroyVideoRenderer;
InitializeCriticalSection( &This->m_csSample );
InitializeCriticalSection( &This->m_csReceive );
hr = QUARTZ_CreateVideoRendererPin(
This,
&This->basefilter.csFilter,
&This->m_csReceive,
&This->pPin );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CompList_AddComp(
......@@ -747,12 +746,13 @@ static void QUARTZ_DestroyVideoRendererPin(IUnknown* punk)
HRESULT QUARTZ_CreateVideoRendererPin(
CVideoRendererImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CVideoRendererPinImpl** ppPin)
{
CVideoRendererPinImpl* This = NULL;
HRESULT hr;
TRACE("(%p,%p,%p)\n",pFilter,pcsPin,ppPin);
TRACE("(%p,%p,%p,%p)\n",pFilter,pcsPin,pcsPinReceive,ppPin);
This = (CVideoRendererPinImpl*)
QUARTZ_AllocObj( sizeof(CVideoRendererPinImpl) );
......@@ -765,7 +765,7 @@ HRESULT QUARTZ_CreateVideoRendererPin(
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin,
pcsPin, pcsPinReceive,
&pFilter->basefilter,
QUARTZ_VideoRendererPin_Name,
FALSE,
......
......@@ -42,7 +42,7 @@ struct CVideoRendererImpl
HANDLE m_hEventInit;
HANDLE m_hThread;
HWND m_hwnd;
CRITICAL_SECTION m_csSample;
CRITICAL_SECTION m_csReceive;
BOOL m_bSampleIsValid;
BYTE* m_pSampleData;
DWORD m_cbSampleData;
......@@ -71,6 +71,7 @@ HRESULT QUARTZ_CreateVideoRenderer(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateVideoRendererPin(
CVideoRendererImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CVideoRendererPinImpl** ppPin);
......
......@@ -57,7 +57,7 @@ static HRESULT CTransformBaseImpl_OnInactive( CBaseFilterImpl* pImpl )
This->pOutPin->pin.pPinConnectedTo == NULL )
return NOERROR;
EnterCriticalSection( &This->csFilter );
EnterCriticalSection( &This->basefilter.csFilter );
pAllocator = This->m_pOutPinAllocator;
if ( pAllocator != NULL &&
......@@ -78,7 +78,7 @@ static HRESULT CTransformBaseImpl_OnInactive( CBaseFilterImpl* pImpl )
hr = NOERROR;
end:
LeaveCriticalSection( &This->csFilter );
LeaveCriticalSection( &This->basefilter.csFilter );
return hr;
}
......@@ -90,7 +90,7 @@ static HRESULT CTransformBaseImpl_OnStop( CBaseFilterImpl* pImpl )
TRACE( "(%p)\n", This );
EnterCriticalSection( &This->csFilter );
EnterCriticalSection( &This->basefilter.csFilter );
if ( This->m_bFiltering )
{
......@@ -110,7 +110,7 @@ static HRESULT CTransformBaseImpl_OnStop( CBaseFilterImpl* pImpl )
IMemAllocator_Decommit( pAllocator );
}
LeaveCriticalSection( &This->csFilter );
LeaveCriticalSection( &This->basefilter.csFilter );
return NOERROR;
}
......@@ -135,14 +135,14 @@ static HRESULT CTransformBaseInPinImpl_OnPostConnect( CPinBaseImpl* pImpl, IPin*
TRACE( "(%p,%p)\n", This, pPin );
EnterCriticalSection( &This->pFilter->csFilter );
EnterCriticalSection( &This->pFilter->basefilter.csFilter );
hr = This->pFilter->m_pHandler->pGetOutputTypes( This->pFilter, This->pFilter->pInPin->pin.pmtConn, &This->pFilter->pOutPin->pin.pmtAcceptTypes, &This->pFilter->pOutPin->pin.cAcceptTypes );
if ( FAILED(hr) )
goto end;
hr = NOERROR;
end:
LeaveCriticalSection( &This->pFilter->csFilter );
LeaveCriticalSection( &This->pFilter->basefilter.csFilter );
return hr;
}
......@@ -170,9 +170,9 @@ static HRESULT CTransformBaseInPinImpl_CheckMediaType( CPinBaseImpl* pImpl, cons
TRACE( "(%p,%p)\n", This, pmt );
EnterCriticalSection( &This->pFilter->csFilter );
EnterCriticalSection( &This->pFilter->basefilter.csFilter );
hr = This->pFilter->m_pHandler->pCheckMediaType( This->pFilter, pmt, (This->pFilter->pOutPin->pin.pPinConnectedTo != NULL) ? This->pFilter->pOutPin->pin.pmtConn : NULL );
LeaveCriticalSection( &This->pFilter->csFilter );
LeaveCriticalSection( &This->pFilter->basefilter.csFilter );
return hr;
}
......@@ -449,9 +449,9 @@ static HRESULT CTransformBaseOutPinImpl_CheckMediaType( CPinBaseImpl* pImpl, con
if ( This->pFilter->pInPin->pin.pPinConnectedTo == NULL )
return E_FAIL;
EnterCriticalSection( &This->pFilter->csFilter );
EnterCriticalSection( &This->pFilter->basefilter.csFilter );
hr = This->pFilter->m_pHandler->pCheckMediaType( This->pFilter, This->pFilter->pInPin->pin.pmtConn, pmt );
LeaveCriticalSection( &This->pFilter->csFilter );
LeaveCriticalSection( &This->pFilter->basefilter.csFilter );
return hr;
}
......@@ -512,7 +512,7 @@ static void QUARTZ_DestroyTransformBase(IUnknown* punk)
CBaseFilterImpl_UninitIBaseFilter(&This->basefilter);
DeleteCriticalSection( &This->csFilter );
DeleteCriticalSection( &This->csReceive );
}
HRESULT QUARTZ_CreateTransformBase(
......@@ -577,11 +577,11 @@ HRESULT QUARTZ_CreateTransformBase(
This->unk.pEntries = FilterIFEntries;
This->unk.dwEntries = sizeof(FilterIFEntries)/sizeof(FilterIFEntries[0]);
This->unk.pOnFinalRelease = QUARTZ_DestroyTransformBase;
InitializeCriticalSection( &This->csFilter );
InitializeCriticalSection( &This->csReceive );
/* create pins. */
hr = QUARTZ_CreateTransformBaseInPin(
This, &This->csFilter,
This, &This->basefilter.csFilter, &This->csReceive,
&This->pInPin, pwszInPinName );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CompList_AddComp(
......@@ -590,7 +590,7 @@ HRESULT QUARTZ_CreateTransformBase(
NULL, 0 );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CreateTransformBaseOutPin(
This, &This->csFilter,
This, &This->basefilter.csFilter,
&This->pOutPin, pwszOutPinName );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CompList_AddComp(
......@@ -642,6 +642,7 @@ static void QUARTZ_DestroyTransformBaseInPin(IUnknown* punk)
HRESULT QUARTZ_CreateTransformBaseInPin(
CTransformBaseImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CTransformBaseInPinImpl** ppPin,
LPCWSTR pwszPinName )
{
......@@ -661,7 +662,7 @@ HRESULT QUARTZ_CreateTransformBaseInPin(
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin,
pcsPin, pcsPinReceive,
&pFilter->basefilter,
pwszPinName,
FALSE,
......@@ -764,7 +765,7 @@ HRESULT QUARTZ_CreateTransformBaseOutPin(
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin,
pcsPin, NULL,
&pFilter->basefilter,
pwszPinName,
TRUE,
......
......@@ -26,7 +26,7 @@ struct CTransformBaseImpl
CTransformBaseOutPinImpl* pOutPin;
CSeekingPassThru* pSeekPass;
CRITICAL_SECTION csFilter;
CRITICAL_SECTION csReceive;
IMemAllocator* m_pOutPinAllocator;
BOOL m_bPreCopy; /* sample must be copied */
BOOL m_bReuseSample; /* sample must be reused */
......@@ -94,6 +94,7 @@ HRESULT QUARTZ_CreateTransformBase(
HRESULT QUARTZ_CreateTransformBaseInPin(
CTransformBaseImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CTransformBaseInPinImpl** ppPin,
LPCWSTR pwszPinName );
HRESULT QUARTZ_CreateTransformBaseOutPin(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment