mediafoundation: Use core dispatcher of current view instead of main view
authorSeungha Yang <seungha@centricular.com>
Fri, 29 May 2020 13:55:56 +0000 (22:55 +0900)
committerSeungha Yang <seungha@centricular.com>
Fri, 29 May 2020 14:01:08 +0000 (23:01 +0900)
Main view might be hidden depending on application's view tree.
In that case, ICoreApplication object doesn't return get_MainView() method

Note that nothing about this behavior was documented by Microsoft
https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.core.coreapplication.mainview

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1310>

sys/mediafoundation/mediacapturewrapper.cpp

index f24de3c..295cf36 100644 (file)
@@ -940,13 +940,8 @@ MediaCaptureWrapper::findCoreDispatcher()
   if (!gst_mf_result(hr))
     return;
 
-  ComPtr<ICoreImmersiveApplication> core_immersive_app;
-  hr = core_app.As(&core_immersive_app);
-  if (!gst_mf_result(hr))
-    return;
-
   ComPtr<ICoreApplicationView> core_app_view;
-  hr = core_immersive_app->get_MainView (&core_app_view);
+  hr = core_app->GetCurrentView (&core_app_view);
   if (!gst_mf_result(hr))
     return;