Zebediah Figura : wineqtdecoder: Do not fail state change methods if source pins are not connected.

Alexandre Julliard julliard at winehq.org
Tue Nov 17 15:04:08 CST 2020


Module: wine
Branch: master
Commit: 7905cc975f60ff7a95f33941df9052b22eba4b82
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7905cc975f60ff7a95f33941df9052b22eba4b82

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Nov 17 11:37:53 2020 -0600

wineqtdecoder: Do not fail state change methods if source pins are not connected.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wineqtdecoder/qtsplitter.c | 20 ++++++++------------
 dlls/wineqtdecoder/qtvdecoder.c | 26 +++++++++++++++++---------
 2 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c
index cabb090e8d3..21fa2376745 100644
--- a/dlls/wineqtdecoder/qtsplitter.c
+++ b/dlls/wineqtdecoder/qtsplitter.c
@@ -278,25 +278,21 @@ static void qt_splitter_destroy(struct strmbase_filter *iface)
 static HRESULT qt_splitter_start_stream(struct strmbase_filter *iface, REFERENCE_TIME time)
 {
     QTSplitter *filter = impl_from_strmbase_filter(iface);
-    HRESULT hr = VFW_E_NOT_CONNECTED, pin_hr;
+    HRESULT hr;
 
     EnterCriticalSection(&filter->csReceive);
 
-    if (filter->pVideo_Pin)
-    {
-        if (SUCCEEDED(pin_hr = BaseOutputPinImpl_Active(&filter->pVideo_Pin->pin)))
-            hr = pin_hr;
-    }
-    if (filter->pAudio_Pin)
-    {
-        if (SUCCEEDED(pin_hr = BaseOutputPinImpl_Active(&filter->pAudio_Pin->pin)))
-            hr = pin_hr;
-    }
+    if (filter->pVideo_Pin && filter->pVideo_Pin->pin.pin.peer
+            && FAILED(hr = IMemAllocator_Commit(filter->pVideo_Pin->pin.pAllocator)))
+        ERR("Failed to commit video allocator, hr %#x.\n", hr);
+    if (filter->pAudio_Pin && filter->pAudio_Pin->pin.pin.peer
+            && FAILED(hr = IMemAllocator_Commit(filter->pAudio_Pin->pin.pAllocator)))
+        ERR("Failed to commit audio allocator, hr %#x.\n", hr);
     SetEvent(filter->runEvent);
 
     LeaveCriticalSection(&filter->csReceive);
 
-    return hr;
+    return S_OK;
 }
 
 static HRESULT qt_splitter_cleanup_stream(struct strmbase_filter *iface)
diff --git a/dlls/wineqtdecoder/qtvdecoder.c b/dlls/wineqtdecoder/qtvdecoder.c
index a86cd432c22..0e17c067df5 100644
--- a/dlls/wineqtdecoder/qtvdecoder.c
+++ b/dlls/wineqtdecoder/qtvdecoder.c
@@ -561,16 +561,18 @@ static void video_decoder_destroy(struct strmbase_filter *iface)
 
 static HRESULT video_decoder_init_stream(struct strmbase_filter *iface)
 {
-    QTVDecoderImpl *This = impl_from_strmbase_filter(iface);
+    QTVDecoderImpl *filter = impl_from_strmbase_filter(iface);
+    HRESULT hr;
 
     OSErr err = noErr;
     ICMDecompressionSessionOptionsRef sessionOptions = NULL;
     ICMDecompressionTrackingCallbackRecord trackingCallbackRecord;
 
     trackingCallbackRecord.decompressionTrackingCallback = trackingCallback;
-    trackingCallbackRecord.decompressionTrackingRefCon = (void*)This;
+    trackingCallbackRecord.decompressionTrackingRefCon = filter;
 
-    err = ICMDecompressionSessionCreate(NULL, This->hImageDescription, sessionOptions, This->outputBufferAttributes, &trackingCallbackRecord, &This->decompressionSession);
+    err = ICMDecompressionSessionCreate(NULL, filter->hImageDescription, sessionOptions,
+            filter->outputBufferAttributes, &trackingCallbackRecord, &filter->decompressionSession);
 
     if (err != noErr)
     {
@@ -578,18 +580,24 @@ static HRESULT video_decoder_init_stream(struct strmbase_filter *iface)
         return E_FAIL;
     }
 
-    return BaseOutputPinImpl_Active(&This->source);
+    if (filter->source.pin.peer && FAILED(hr = IMemAllocator_Commit(filter->source.pAllocator)))
+        ERR("Failed to commit allocator, hr %#x.\n", hr);
+
+    return S_OK;
 }
 
 static HRESULT video_decoder_cleanup_stream(struct strmbase_filter *iface)
 {
-    QTVDecoderImpl* This = impl_from_strmbase_filter(iface);
+    QTVDecoderImpl *filter = impl_from_strmbase_filter(iface);
+
+    if (filter->decompressionSession)
+        ICMDecompressionSessionRelease(filter->decompressionSession);
+    filter->decompressionSession = NULL;
 
-    if (This->decompressionSession)
-        ICMDecompressionSessionRelease(This->decompressionSession);
-    This->decompressionSession = NULL;
+    if (filter->source.pin.peer)
+        IMemAllocator_Decommit(filter->source.pAllocator);
 
-    return BaseOutputPinImpl_Inactive(&This->source);
+    return S_OK;
 }
 
 static const struct strmbase_filter_ops filter_ops =




More information about the wine-cvs mailing list