Seungha Yang 2021-03-20 16:26:21 +09:00
parent 824b0ce0f4
commit e22befad2e
2 changed files with 18 additions and 1 deletions

View file

@ -28,6 +28,10 @@
#include "gstmfvideobuffer.h"
#include <string.h>
#if GST_MF_HAVE_D3D11
#include <d3d10.h>
#endif
using namespace Microsoft::WRL;
G_BEGIN_DECLS
@ -135,6 +139,7 @@ gst_mf_video_enc_open (GstVideoEncoder * enc)
if (device_caps->d3d11_aware) {
HRESULT hr;
ID3D11Device *device_handle;
ComPtr<ID3D10Multithread> multi_thread;
GstD3D11Device *device;
if (!gst_d3d11_ensure_element_data (GST_ELEMENT_CAST (self),
@ -164,6 +169,18 @@ gst_mf_video_enc_open (GstVideoEncoder * enc)
}
device_handle = gst_d3d11_device_get_device_handle (device);
/* Enable multi thread protection as this device will be shared with
* MFT */
hr = device_handle->QueryInterface (IID_PPV_ARGS (&multi_thread));
if (!gst_d3d11_result (hr, device)) {
GST_WARNING_OBJECT (self,
"device doesn't suport ID3D10Multithread interface");
gst_clear_object (&self->other_d3d11_device);
gst_clear_object (&self->d3d11_device);
}
multi_thread->SetMultithreadProtected (TRUE);
hr = self->device_manager->ResetDevice ((IUnknown *) device_handle,
self->reset_token);
if (!gst_mf_result (hr)) {

View file

@ -127,7 +127,7 @@ if winapi_desktop
# Since MFTEnum2 is desktop only we don't support d3d11 interop for UWP build
# And because MFTEnum2 is Windows 10 API, we will load MFTEnum2 symbol
# by using g_module_open() so that keep supporting old OS versions
if gstd3d11_dep.found() and cc.has_header('d3d11_4.h')
if gstd3d11_dep.found() and cc.has_header('d3d11_4.h') and cc.has_header('d3d10.h')
have_mf_d3d11 = true
mf_lib_deps += [gstd3d11_dep, gmodule_dep]
extra_c_args += ['-DGST_USE_UNSTABLE_API']