diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-05-20 15:47:48 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-08-08 11:43:14 +0200 |
commit | 70ad769934d9c82e1d1dd11e96386ce59db7631e (patch) | |
tree | 876e175df45ac2a1eaf71c418b737d5b4667e852 /src/gsttools/qgstreamerplayercontrol.cpp | |
parent | 6e9b2aadbbd18faa1a5cc47ae808d96b56508ffa (diff) | |
download | qtmultimedia-70ad769934d9c82e1d1dd11e96386ce59db7631e.tar.gz |
GStreamer: Don't seek to the beginning when playing is requested
We promised to not provide any video frames before pause() or play() is called.
Regardless the media is loaded or not.
It should work like following:
setMedia(new)
// ...
// no video frames returned yet
pause()
// prerolled frame should be shown
To implement this, i.e. showing the prerolled frame after pause, we do seeking to the beginning.
But it is totally not necessarily when play() is requested,
since here is new media and playback will start from the beginning anyway.
This also produces a hang/stuck on some embedded systems with custom pipelines or playing from qrc.
So decided to show prerolled frame and this means to seek to the beginning only when pause() is called.
Task-number: QTBUG-65399
Change-Id: I9b3dc632fa0df4a1115d852c2d480fd5c7fd9ee5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/gsttools/qgstreamerplayercontrol.cpp')
-rw-r--r-- | src/gsttools/qgstreamerplayercontrol.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gsttools/qgstreamerplayercontrol.cpp b/src/gsttools/qgstreamerplayercontrol.cpp index 73f43f0b9..d49b09af4 100644 --- a/src/gsttools/qgstreamerplayercontrol.cpp +++ b/src/gsttools/qgstreamerplayercontrol.cpp @@ -225,6 +225,10 @@ void QGstreamerPlayerControl::pause() qDebug() << Q_FUNC_INFO; #endif m_userRequestedState = QMediaPlayer::PausedState; + // If the playback has not been started yet but pause is requested. + // Seek to the beginning to show first frame. + if (m_pendingSeekPosition == -1 && m_session->position() == 0) + m_pendingSeekPosition = 0; playOrPause(QMediaPlayer::PausedState); } @@ -354,7 +358,7 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice * m_currentState = QMediaPlayer::StoppedState; QMediaContent oldMedia = m_currentResource; - m_pendingSeekPosition = 0; + m_pendingSeekPosition = -1; m_session->showPrerollFrames(false); // do not show prerolled frames until pause() or play() explicitly called m_setMediaPending = false; |