diff options
author | André de la Rocha <andre.rocha@qt.io> | 2022-03-16 21:24:05 -0300 |
---|---|---|
committer | André de la Rocha <andre.rocha@qt.io> | 2022-03-17 08:54:37 +0000 |
commit | b068cb359996d0a5125b3b8bc341854674b7cbb7 (patch) | |
tree | d22586dcf95512cfc474ae15d5118837b1e7f62c /src/plugins/multimedia/windows | |
parent | 6ed6d0ab838c8e9a808105376c5a92747f1a252c (diff) |
Windows: Rework workaround for WMF issue
What seems to be a WMF issue was causing a crash with specific videos
and also issues when changing position of flac files. A previous
workaround for it was depending on the way the media playing was started
and thus seemed to fix the issue when tested with the Widgets-based
Media Player example, but still failed with the QML-based one. This
patch seems to fix it for all cases.
Fixes: QTBUG-100854
Fixes: QTBUG-100181
Pick-to: 6.2 6.3
Change-Id: I7e46d72b5e656383442d2866ef93f3183c9f9fa7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/multimedia/windows')
3 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/multimedia/windows/player/mfplayercontrol.cpp b/src/plugins/multimedia/windows/player/mfplayercontrol.cpp index eb2c84f4e..67a5caa7b 100644 --- a/src/plugins/multimedia/windows/player/mfplayercontrol.cpp +++ b/src/plugins/multimedia/windows/player/mfplayercontrol.cpp @@ -96,8 +96,6 @@ void MFPlayerControl::play() case QMediaPlayer::BufferedMedia: case QMediaPlayer::EndOfMedia: changeState(QMediaPlayer::PlayingState); - if (m_session->status() == QMediaPlayer::LoadedMedia) - m_session->updateOutputRouting(); m_session->start(); break; default: //Loading/Stalled diff --git a/src/plugins/multimedia/windows/player/mfplayersession.cpp b/src/plugins/multimedia/windows/player/mfplayersession.cpp index 544567e5b..bd5557d38 100644 --- a/src/plugins/multimedia/windows/player/mfplayersession.cpp +++ b/src/plugins/multimedia/windows/player/mfplayersession.cpp @@ -216,6 +216,7 @@ void MFPlayerSession::load(const QUrl &url, QIODevice *stream) createSession(); changeStatus(QMediaPlayer::LoadingMedia); m_sourceResolver->load(url, stream); + m_updateRoutingOnStart = true; } positionChanged(position()); } @@ -1068,6 +1069,11 @@ void MFPlayerSession::stop(bool immediate) void MFPlayerSession::start() { + if (status() == QMediaPlayer::LoadedMedia && m_updateRoutingOnStart) { + m_updateRoutingOnStart = false; + updateOutputRouting(); + } + if (m_status == QMediaPlayer::EndOfMedia) { m_position = 0; // restart from the beginning positionChanged(0); diff --git a/src/plugins/multimedia/windows/player/mfplayersession_p.h b/src/plugins/multimedia/windows/player/mfplayersession_p.h index a8456f641..8f1af9f8b 100644 --- a/src/plugins/multimedia/windows/player/mfplayersession_p.h +++ b/src/plugins/multimedia/windows/player/mfplayersession_p.h @@ -177,6 +177,7 @@ private: qint64 m_lastSeekPos = 0; MFTIME m_lastSeekSysTime = 0; bool m_altTiming = false; + bool m_updateRoutingOnStart = false; enum Command { |