summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Dubsky <pavel.dubsky@qt.io>2023-04-25 12:29:49 +0200
committerPavel Dubsky <pavel.dubsky@qt.io>2023-04-26 10:52:35 +0200
commit1689940a061235545d6cc316fcc924284e7c3f1b (patch)
tree6a84853305799c8f8e8eb458d065a807f736fc9d
parentbd1487b17d0806a79cc74b911008a533e1ec3036 (diff)
downloadqtmultimedia-1689940a061235545d6cc316fcc924284e7c3f1b.tar.gz
Fix QMediaDevices::videoInputs returning an empty list
When QMediaDevices::videoInputs is called without prior call to QMediaDevices::audioOutputs the returned list is empty but if the latter call is present everything works as it should. The reason is a missing call to CoInitialize inside internal Windows-specific implementation. Task-number: QTBUG-112702 Pick-to: 6.5 Change-Id: I462d3cf15f65329415539eb1bdde6be65ab9a407 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
-rw-r--r--src/plugins/multimedia/windows/qwindowsvideodevices.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/multimedia/windows/qwindowsvideodevices.cpp b/src/plugins/multimedia/windows/qwindowsvideodevices.cpp
index 41ccb4733..bd0624bfc 100644
--- a/src/plugins/multimedia/windows/qwindowsvideodevices.cpp
+++ b/src/plugins/multimedia/windows/qwindowsvideodevices.cpp
@@ -59,6 +59,8 @@ static HWND createMessageOnlyWindow()
QWindowsVideoDevices::QWindowsVideoDevices(QPlatformMediaIntegration *integration)
: QPlatformVideoDevices(integration)
{
+ CoInitialize(nullptr);
+
m_videoDeviceMsgWindow = createMessageOnlyWindow();
if (m_videoDeviceMsgWindow) {
SetWindowLongPtr(m_videoDeviceMsgWindow, GWLP_USERDATA, (LONG_PTR)this);
@@ -93,6 +95,8 @@ QWindowsVideoDevices::~QWindowsVideoDevices()
DestroyWindow(m_videoDeviceMsgWindow);
UnregisterClass(windowClassName, GetModuleHandle(nullptr));
}
+
+ CoUninitialize();
}
static std::optional<QCameraFormat> createCameraFormat(IMFMediaType *mediaFormat)