[vlc-commits] [Git][videolan/vlc][master] mft: call IMFShutdown::Shutdown on exit

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Jan 14 13:13:57 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
77067e69 by Steve Lhomme at 2024-01-14T12:56:23+00:00
mft: call IMFShutdown::Shutdown on exit

It is mandatory for asynchronous MFTs [1].

[1] https://learn.microsoft.com/en-us/windows/win32/api/mfidl/nn-mfidl-imfshutdown

- - - - -


1 changed file:

- modules/codec/mft.cpp


Changes:

=====================================
modules/codec/mft.cpp
=====================================
@@ -50,6 +50,7 @@ extern "C" {
 #include <mferror.h>
 #include <mfobjects.h>
 #include <codecapi.h>
+#include <mfidl.h>
 
 
 #if !defined(CODECAPI_AVDecVideoAcceleration_H264) // MINGW < 8
@@ -190,6 +191,16 @@ public:
         return hr;
     }
 
+    /// Required for Async MFTs
+    HRESULT shutdownStream()
+    {
+        ComPtr<IMFShutdown> shutdownObj;
+        HRESULT hr = mft.As(&shutdownObj);
+        if (FAILED(hr))
+            return hr;
+        return shutdownObj->Shutdown();
+    }
+
 private:
     bool streamStarted = false;
     std::atomic<size_t>  refcount{1};
@@ -1657,6 +1668,8 @@ static void DestroyMFT(decoder_t *p_dec)
 
         // make sure don't have any input pending
         p_sys->flushStream();
+
+        p_sys->shutdownStream();
     }
 
     auto *vidsys = dynamic_cast<mft_dec_video*>(p_sys);
@@ -2215,6 +2228,8 @@ static void EncoderClose(encoder_t *p_enc)
 
         // make sure don't have any input pending
         p_sys->flushStream();
+
+        p_sys->shutdownStream();
     }
 
     p_sys->Release();



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/77067e69388d256e98cfe73f3408f6be0234bc0a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/77067e69388d256e98cfe73f3408f6be0234bc0a
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list