summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré de la Rocha <andre.rocha@qt.io>2022-10-21 20:21:34 +0200
committerAndré de la Rocha <andre.rocha@qt.io>2022-10-27 17:25:34 +0200
commitd1e3cb9034bf0ebf45b55082217580f4b4a2b790 (patch)
treed26a2d3493a2eeeae41e137df7cf8cb87328e8bf
parente5c0d3ecb7e6ddf72f52face5acd3ffea77a699d (diff)
Windows: do not add audio output to topology when there is no output device
Otherwise videos with audio fail to play when there is no audio output device, instead of just playing the video without audio. Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-107205 Change-Id: Ie296023251e3b7c019e63ca09dc68663230aa013 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
-rw-r--r--src/plugins/multimedia/windows/player/mfplayersession.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/plugins/multimedia/windows/player/mfplayersession.cpp b/src/plugins/multimedia/windows/player/mfplayersession.cpp
index 22cdd90bb..c500b54b9 100644
--- a/src/plugins/multimedia/windows/player/mfplayersession.cpp
+++ b/src/plugins/multimedia/windows/player/mfplayersession.cpp
@@ -468,20 +468,15 @@ IMFTopologyNode* MFPlayerSession::addOutputNode(MediaType mediaType, IMFTopology
}
auto id = m_audioOutput->device.id();
- if (!id.isEmpty()) {
- QString s = QString::fromUtf8(id);
- hr = activate->SetString(MF_AUDIO_RENDERER_ATTRIBUTE_ENDPOINT_ID, (LPCWSTR)s.utf16());
- } else {
- //This is the default one that has been inserted in updateEndpoints(),
- //so give the activate a hint that we want to use the device for multimedia playback
- //then the media foundation will choose an appropriate one.
-
- //from MSDN:
- //The ERole enumeration defines constants that indicate the role that the system has assigned to an audio endpoint device.
- //eMultimedia: Music, movies, narration, and live music recording.
- hr = activate->SetUINT32(MF_AUDIO_RENDERER_ATTRIBUTE_ENDPOINT_ROLE, eMultimedia);
+ if (id.isEmpty()) {
+ qWarning() << "No audio output";
+ activate->Release();
+ node->Release();
+ return NULL;
}
+ QString s = QString::fromUtf8(id);
+ hr = activate->SetString(MF_AUDIO_RENDERER_ATTRIBUTE_ENDPOINT_ID, (LPCWSTR)s.utf16());
if (FAILED(hr)) {
qWarning() << "Failed to set attribute for audio device" << m_audioOutput->device.description();
activate->Release();