Fix WMF Video not playing if no soundcard is available

Do not add the AudioEndpoint to the topology if no Audio output device
is available. Fixes video not playing if you deactivate your soundcard
or have no headphones/speakers plugged in.

Change-Id: I9fc2486198a299b3e75af648f69475270968c6f7
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
Marius Wachtler
2013-11-25 15:22:56 +01:00
committed by The Qt Project
parent 6799e9eab0
commit 160656d688

View File

@@ -60,6 +60,8 @@ void MFAudioEndpointControl::clear()
foreach (LPWSTR wstrID, m_devices) foreach (LPWSTR wstrID, m_devices)
CoTaskMemFree(wstrID); CoTaskMemFree(wstrID);
m_devices.clear();
if (m_currentActivate) if (m_currentActivate)
m_currentActivate->Release(); m_currentActivate->Release();
m_currentActivate = NULL; m_currentActivate = NULL;
@@ -130,6 +132,11 @@ IMFActivate* MFAudioEndpointControl::createActivate()
clear(); clear();
updateEndpoints(); updateEndpoints();
// Check if an endpoint is available ("Default" is always inserted)
if (m_devices.count() <= 1)
return NULL;
setActiveOutput(m_defaultEndpoint); setActiveOutput(m_defaultEndpoint);
return m_currentActivate; return m_currentActivate;