[PATCH 4/5] quartz/avidec: Use the strmbase stream lock.

Zebediah Figura z.figura12 at gmail.com
Tue Jan 19 21:35:37 CST 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/quartz/avidec.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c
index 77d2b5e2aa5..b1e07fe5879 100644
--- a/dlls/quartz/avidec.c
+++ b/dlls/quartz/avidec.c
@@ -39,7 +39,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
 struct avi_decompressor
 {
     struct strmbase_filter filter;
-    CRITICAL_SECTION stream_cs;
 
     struct strmbase_source source;
     IQualityControl source_IQualityControl_iface;
@@ -129,13 +128,10 @@ static HRESULT WINAPI avi_decompressor_sink_Receive(struct strmbase_sink *iface,
     if (This->sink.flushing)
         return S_FALSE;
 
-    EnterCriticalSection(&This->stream_cs);
-
     hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
     if (FAILED(hr))
     {
         ERR("Cannot get pointer to sample data (%x)\n", hr);
-        LeaveCriticalSection(&This->stream_cs);
         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);
     if (FAILED(hr)) {
         ERR("Unable to get delivery buffer (%x)\n", hr);
-        LeaveCriticalSection(&This->stream_cs);
         return hr;
     }
 
@@ -160,7 +155,6 @@ static HRESULT WINAPI avi_decompressor_sink_Receive(struct strmbase_sink *iface,
     if (FAILED(hr)) {
 	ERR("Unable to get pointer to buffer (%x)\n", hr);
         IMediaSample_Release(pOutSample);
-        LeaveCriticalSection(&This->stream_cs);
         return hr;
     }
     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);
         IMediaSample_Release(pOutSample);
-        LeaveCriticalSection(&This->stream_cs);
         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 */
     if (flags & ICDECOMPRESS_HURRYUP) {
         IMediaSample_Release(pOutSample);
-        LeaveCriticalSection(&This->stream_cs);
         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);
 
     IMediaSample_Release(pOutSample);
-    LeaveCriticalSection(&This->stream_cs);
     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",
             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)
         filter->late = q.Late + q.TimeStamp;
     else
         filter->late = -1;
-    LeaveCriticalSection(&filter->stream_cs);
+    LeaveCriticalSection(&filter->filter.stream_cs);
     return S_OK;
 }
 
@@ -545,8 +536,6 @@ static void avi_decompressor_destroy(struct strmbase_filter *iface)
     strmbase_source_cleanup(&filter->source);
     strmbase_passthrough_cleanup(&filter->passthrough);
 
-    filter->stream_cs.DebugInfo->Spare[0] = 0;
-    DeleteCriticalSection(&filter->stream_cs);
     strmbase_filter_cleanup(&filter->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);
 
-    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_source_init(&object->source, &object->filter, L"Out", &source_ops);
-- 
2.30.0




More information about the wine-devel mailing list