quartz/avidec: Use the strmbase stream lock.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
53d8a28a43
commit
92ee89c9d3
|
@ -39,7 +39,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
||||||
struct avi_decompressor
|
struct avi_decompressor
|
||||||
{
|
{
|
||||||
struct strmbase_filter filter;
|
struct strmbase_filter filter;
|
||||||
CRITICAL_SECTION stream_cs;
|
|
||||||
|
|
||||||
struct strmbase_source source;
|
struct strmbase_source source;
|
||||||
IQualityControl source_IQualityControl_iface;
|
IQualityControl source_IQualityControl_iface;
|
||||||
|
@ -129,13 +128,10 @@ static HRESULT WINAPI avi_decompressor_sink_Receive(struct strmbase_sink *iface,
|
||||||
if (This->sink.flushing)
|
if (This->sink.flushing)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
EnterCriticalSection(&This->stream_cs);
|
|
||||||
|
|
||||||
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("Cannot get pointer to sample data (%x)\n", hr);
|
ERR("Cannot get pointer to sample data (%x)\n", hr);
|
||||||
LeaveCriticalSection(&This->stream_cs);
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +145,6 @@ static HRESULT WINAPI avi_decompressor_sink_Receive(struct strmbase_sink *iface,
|
||||||
hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->source, &pOutSample, NULL, NULL, 0);
|
hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->source, &pOutSample, NULL, NULL, 0);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
ERR("Unable to get delivery buffer (%x)\n", hr);
|
ERR("Unable to get delivery buffer (%x)\n", hr);
|
||||||
LeaveCriticalSection(&This->stream_cs);
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +155,6 @@ static HRESULT WINAPI avi_decompressor_sink_Receive(struct strmbase_sink *iface,
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
ERR("Unable to get pointer to buffer (%x)\n", hr);
|
ERR("Unable to get pointer to buffer (%x)\n", hr);
|
||||||
IMediaSample_Release(pOutSample);
|
IMediaSample_Release(pOutSample);
|
||||||
LeaveCriticalSection(&This->stream_cs);
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
cbDstStream = IMediaSample_GetSize(pOutSample);
|
cbDstStream = IMediaSample_GetSize(pOutSample);
|
||||||
|
@ -168,7 +162,6 @@ static HRESULT WINAPI avi_decompressor_sink_Receive(struct strmbase_sink *iface,
|
||||||
{
|
{
|
||||||
ERR("Sample size is too small (%u < %u).\n", cbDstStream, source_format->bmiHeader.biSizeImage);
|
ERR("Sample size is too small (%u < %u).\n", cbDstStream, source_format->bmiHeader.biSizeImage);
|
||||||
IMediaSample_Release(pOutSample);
|
IMediaSample_Release(pOutSample);
|
||||||
LeaveCriticalSection(&This->stream_cs);
|
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +180,6 @@ static HRESULT WINAPI avi_decompressor_sink_Receive(struct strmbase_sink *iface,
|
||||||
/* Drop sample if it's intended to be dropped */
|
/* Drop sample if it's intended to be dropped */
|
||||||
if (flags & ICDECOMPRESS_HURRYUP) {
|
if (flags & ICDECOMPRESS_HURRYUP) {
|
||||||
IMediaSample_Release(pOutSample);
|
IMediaSample_Release(pOutSample);
|
||||||
LeaveCriticalSection(&This->stream_cs);
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +201,6 @@ static HRESULT WINAPI avi_decompressor_sink_Receive(struct strmbase_sink *iface,
|
||||||
ERR("Error sending sample (%x)\n", hr);
|
ERR("Error sending sample (%x)\n", hr);
|
||||||
|
|
||||||
IMediaSample_Release(pOutSample);
|
IMediaSample_Release(pOutSample);
|
||||||
LeaveCriticalSection(&This->stream_cs);
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,12 +482,12 @@ static HRESULT WINAPI avi_decompressor_source_qc_Notify(IQualityControl *iface,
|
||||||
TRACE("filter %p, sender %p, type %#x, proportion %u, late %s, timestamp %s.\n",
|
TRACE("filter %p, sender %p, type %#x, proportion %u, late %s, timestamp %s.\n",
|
||||||
filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp));
|
filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp));
|
||||||
|
|
||||||
EnterCriticalSection(&filter->stream_cs);
|
EnterCriticalSection(&filter->filter.stream_cs);
|
||||||
if (q.Late > 0)
|
if (q.Late > 0)
|
||||||
filter->late = q.Late + q.TimeStamp;
|
filter->late = q.Late + q.TimeStamp;
|
||||||
else
|
else
|
||||||
filter->late = -1;
|
filter->late = -1;
|
||||||
LeaveCriticalSection(&filter->stream_cs);
|
LeaveCriticalSection(&filter->filter.stream_cs);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,8 +536,6 @@ static void avi_decompressor_destroy(struct strmbase_filter *iface)
|
||||||
strmbase_source_cleanup(&filter->source);
|
strmbase_source_cleanup(&filter->source);
|
||||||
strmbase_passthrough_cleanup(&filter->passthrough);
|
strmbase_passthrough_cleanup(&filter->passthrough);
|
||||||
|
|
||||||
filter->stream_cs.DebugInfo->Spare[0] = 0;
|
|
||||||
DeleteCriticalSection(&filter->stream_cs);
|
|
||||||
strmbase_filter_cleanup(&filter->filter);
|
strmbase_filter_cleanup(&filter->filter);
|
||||||
free(filter);
|
free(filter);
|
||||||
|
|
||||||
|
@ -614,9 +603,6 @@ HRESULT avi_dec_create(IUnknown *outer, IUnknown **out)
|
||||||
|
|
||||||
strmbase_filter_init(&object->filter, outer, &CLSID_AVIDec, &filter_ops);
|
strmbase_filter_init(&object->filter, outer, &CLSID_AVIDec, &filter_ops);
|
||||||
|
|
||||||
InitializeCriticalSection(&object->stream_cs);
|
|
||||||
object->stream_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__": avi_decompressor.stream_cs");
|
|
||||||
|
|
||||||
strmbase_sink_init(&object->sink, &object->filter, L"In", &sink_ops, NULL);
|
strmbase_sink_init(&object->sink, &object->filter, L"In", &sink_ops, NULL);
|
||||||
|
|
||||||
strmbase_source_init(&object->source, &object->filter, L"Out", &source_ops);
|
strmbase_source_init(&object->source, &object->filter, L"Out", &source_ops);
|
||||||
|
|
Loading…
Reference in New Issue