diff options
author | Tim Blechmann <tim@klingt.org> | 2024-03-28 12:39:33 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-29 06:25:35 +0000 |
commit | 92f27df3d14317d3914346d6f9d290d903e12459 (patch) | |
tree | bffb620061fcb70c75953e217240d534a66d0556 | |
parent | a25fd744e70897225de43e1cb2e3d3afc24a868c (diff) |
GStreamer: remove relic of restarting playback after new source is set
`QGstreamerMediaPlayer::setMedia` tried to restart the playback state if
the playback was running before setting them media. However
`QMediaPlayer::setSource` explicitly stops the playback.
Removing the code and documenting the setSource behavior in the public
documentation
Pick-to: 6.5
Change-Id: I03722afc2bb6f87f79c005a3b64ca7e036ac27f2
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit b915eb159537bfa85bbeb760b032772cbddf1f59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit fe857a9f27a4eb3b99ad3a70ba00abd04d3fb252)
-rw-r--r-- | src/multimedia/playback/qmediaplayer.cpp | 2 | ||||
-rw-r--r-- | src/plugins/multimedia/gstreamer/common/qgstreamermediaplayer.cpp | 13 |
2 files changed, 4 insertions, 11 deletions
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 2e504bdf8..a5b43dc32 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -591,7 +591,7 @@ void QMediaPlayer::setPlaybackRate(qreal rate) Setting the media to a null QUrl will cause the player to discard all information relating to the current media source and to cease all I/O operations related - to that media. + to that media. Setting the media will stop the playback. \note This function returns immediately after recording the specified source of the media. It does not wait for the media to finish loading and does not check for errors. Listen for diff --git a/src/plugins/multimedia/gstreamer/common/qgstreamermediaplayer.cpp b/src/plugins/multimedia/gstreamer/common/qgstreamermediaplayer.cpp index 19fffc082..e318c14eb 100644 --- a/src/plugins/multimedia/gstreamer/common/qgstreamermediaplayer.cpp +++ b/src/plugins/multimedia/gstreamer/common/qgstreamermediaplayer.cpp @@ -680,7 +680,7 @@ void QGstreamerMediaPlayer::setMedia(const QUrl &content, QIODevice *stream) decoder = QGstElement(); removeAllOutputs(); seekableChanged(false); - playerPipeline.setInStoppedState(true); + Q_ASSERT(playerPipeline.inStoppedState()); if (m_duration != 0) { m_duration = 0; @@ -756,15 +756,8 @@ void QGstreamerMediaPlayer::setMedia(const QUrl &content, QIODevice *stream) mediaStatusChanged(QMediaPlayer::LoadingMedia); - if (state() == QMediaPlayer::PlayingState) { - int ret = playerPipeline.setState(GST_STATE_PLAYING); - if (ret == GST_STATE_CHANGE_FAILURE) - qCWarning(qLcMediaPlayer) << "Unable to set the pipeline to the playing state."; - } else { - int ret = playerPipeline.setState(GST_STATE_PAUSED); - if (!ret) - qCWarning(qLcMediaPlayer) << "Unable to set the pipeline to the paused state."; - } + if (!playerPipeline.setState(GST_STATE_PAUSED)) + qCWarning(qLcMediaPlayer) << "Unable to set the pipeline to the paused state."; playerPipeline.setPosition(0); positionChanged(0); |