Zebediah Figura : strmbase/transform: Hold the streaming lock for the entirety of Receive().
Alexandre Julliard
julliard at winehq.org
Mon Dec 2 17:10:14 CST 2019
Module: wine
Branch: master
Commit: 3a7f54947e77e6a3bed4f74ae61759f731b1451a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3a7f54947e77e6a3bed4f74ae61759f731b1451a
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sat Nov 30 19:48:32 2019 -0600
strmbase/transform: Hold the streaming lock for the entirety of Receive().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/acmwrapper.c | 4 ----
dlls/quartz/avidec.c | 22 +++++++++-------------
dlls/strmbase/transform.c | 2 +-
dlls/winegstreamer/gsttffilter.c | 3 ---
4 files changed, 10 insertions(+), 21 deletions(-)
diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c
index 64e0018980..8eea6ab147 100644
--- a/dlls/quartz/acmwrapper.c
+++ b/dlls/quartz/acmwrapper.c
@@ -66,12 +66,10 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam
LONGLONG tStart = -1, tStop = -1, tMed;
LONGLONG mtStart = -1, mtStop = -1, mtMed;
- EnterCriticalSection(&This->tf.csReceive);
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
if (FAILED(hr))
{
ERR("Cannot get pointer to sample data (%x)\n", hr);
- LeaveCriticalSection(&This->tf.csReceive);
return hr;
}
@@ -107,7 +105,6 @@ static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSam
if (FAILED(hr))
{
ERR("Unable to get delivery buffer (%x)\n", hr);
- LeaveCriticalSection(&This->tf.csReceive);
return hr;
}
IMediaSample_SetPreroll(pOutSample, preroll);
@@ -224,7 +221,6 @@ error:
This->lasttime_real = tStop;
This->lasttime_sent = tMed;
- LeaveCriticalSection(&This->tf.csReceive);
return hr;
}
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c
index cbe109df2b..32969a3473 100644
--- a/dlls/quartz/avidec.c
+++ b/dlls/quartz/avidec.c
@@ -111,12 +111,11 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
LONGLONG tStart, tStop;
DWORD flags = 0;
- EnterCriticalSection(&This->tf.csReceive);
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
if (FAILED(hr))
{
ERR("Cannot get pointer to sample data (%x)\n", hr);
- goto error;
+ return hr;
}
cbSrcStream = IMediaSample_GetActualDataLength(pSample);
@@ -129,7 +128,7 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->tf.source, &pOutSample, NULL, NULL, 0);
if (FAILED(hr)) {
ERR("Unable to get delivery buffer (%x)\n", hr);
- goto error;
+ return hr;
}
hr = IMediaSample_SetActualDataLength(pOutSample, 0);
@@ -138,13 +137,14 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
hr = IMediaSample_GetPointer(pOutSample, &pbDstStream);
if (FAILED(hr)) {
ERR("Unable to get pointer to buffer (%x)\n", hr);
- goto error;
+ IMediaSample_Release(pOutSample);
+ return hr;
}
cbDstStream = IMediaSample_GetSize(pOutSample);
if (cbDstStream < This->pBihOut->biSizeImage) {
ERR("Sample size is too small %d < %d\n", cbDstStream, This->pBihOut->biSizeImage);
- hr = E_FAIL;
- goto error;
+ IMediaSample_Release(pOutSample);
+ return E_FAIL;
}
if (IMediaSample_IsPreroll(pSample) == S_OK)
@@ -161,8 +161,8 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
/* Drop sample if it's intended to be dropped */
if (flags & ICDECOMPRESS_HURRYUP) {
- hr = S_OK;
- goto error;
+ IMediaSample_Release(pOutSample);
+ return S_OK;
}
IMediaSample_SetActualDataLength(pOutSample, This->pBihOut->biSizeImage);
@@ -187,11 +187,7 @@ static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED)
ERR("Error sending sample (%x)\n", hr);
-error:
- if (pOutSample)
- IMediaSample_Release(pOutSample);
-
- LeaveCriticalSection(&This->tf.csReceive);
+ IMediaSample_Release(pOutSample);
return hr;
}
diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c
index 7650232c44..9e2582a0db 100644
--- a/dlls/strmbase/transform.c
+++ b/dlls/strmbase/transform.c
@@ -82,12 +82,12 @@ static HRESULT WINAPI TransformFilter_Input_Receive(struct strmbase_sink *This,
return S_FALSE;
}
- LeaveCriticalSection(&pTransform->csReceive);
if (pTransform->pFuncsTable->pfnReceive)
hr = pTransform->pFuncsTable->pfnReceive(pTransform, pInSample);
else
hr = S_FALSE;
+ LeaveCriticalSection(&pTransform->csReceive);
return hr;
}
diff --git a/dlls/winegstreamer/gsttffilter.c b/dlls/winegstreamer/gsttffilter.c
index baa4c0c2c5..9ff5f8741d 100644
--- a/dlls/winegstreamer/gsttffilter.c
+++ b/dlls/winegstreamer/gsttffilter.c
@@ -227,7 +227,6 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
mark_wine_thread();
- EnterCriticalSection(&This->tf.csReceive);
IMediaSample_GetPointer(sample, &data);
IMediaSample_AddRef(sample);
@@ -235,7 +234,6 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
buf = gst_buffer_new_wrapped_full(0, data, bufsize, 0, bufsize, sample, release_sample_wrapper);
if (!buf) {
IMediaSample_Release(sample);
- LeaveCriticalSection(&This->tf.csReceive);
return S_OK;
}
@@ -259,7 +257,6 @@ static HRESULT WINAPI Gstreamer_transform_ProcessData(TransformFilter *iface, IM
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_LIVE);
if (IMediaSample_IsSyncPoint(sample) != S_OK)
GST_BUFFER_FLAG_SET(buf, GST_BUFFER_FLAG_DELTA_UNIT);
- LeaveCriticalSection(&This->tf.csReceive);
ret = gst_pad_push(This->my_src, buf);
if (ret)
WARN("Sending returned: %i\n", ret);
More information about the wine-cvs
mailing list