diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2017-09-29 17:10:32 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-09-06 14:22:11 +0000 |
commit | c5400d31a40847e2905b11759090400653624a94 (patch) | |
tree | df88a6c82d6da8c5c23ecc142de9a73d9a206f54 | |
parent | f844a2acbb7ecc4d7b1776d1d6eeb8feab7044f1 (diff) | |
download | qtmultimedia-c5400d31a40847e2905b11759090400653624a94.tar.gz |
Fix Gstreamer plugin to pass tst_QMediaPlayerBackend
- Fixed to provide QMediaPlayer::LoadedMedia media status
in case when play -> pause -> stop made.
- Fixed default duration -1 -> 0.
- Fixed a test because after pause() positionChanged is always emitted.
- Enabled the test.
- Increased gap between prev and curr position after pause.
Task-number: QTBUG-63517
Change-Id: I377f024d0a976f1ce802fe6740a771b7e0f2e8db
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
4 files changed, 12 insertions, 8 deletions
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp index 0bfe76f2f..ff17e37eb 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp @@ -308,7 +308,12 @@ void QGstreamerPlayerControl::stop() if (m_currentState != QMediaPlayer::StoppedState) { m_currentState = QMediaPlayer::StoppedState; m_session->showPrerollFrames(false); // stop showing prerolled frames in stop state - if (m_resources->isGranted()) + // Since gst is not going to send GST_STATE_PAUSED + // when pipeline is already paused, + // needs to update media status directly. + if (m_session->state() == QMediaPlayer::PausedState) + updateMediaStatus(); + else if (m_resources->isGranted()) m_session->pause(); if (m_mediaStatus != QMediaPlayer::EndOfMedia) { diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp index a96da66f8..d7cc5ed12 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -138,7 +138,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) m_videoAvailable(false), m_seekable(false), m_lastPosition(0), - m_duration(-1), + m_duration(0), m_durationQueries(0), m_displayPrerolledFrame(true), m_sourceType(UnknownSrc), @@ -294,7 +294,7 @@ void QGstreamerPlayerSession::loadFromStream(const QNetworkRequest &request, QIO qDebug() << Q_FUNC_INFO; #endif m_request = request; - m_duration = -1; + m_duration = 0; m_lastPosition = 0; if (!m_appSrc) @@ -323,7 +323,7 @@ void QGstreamerPlayerSession::loadFromUri(const QNetworkRequest &request) qDebug() << Q_FUNC_INFO << request.url(); #endif m_request = request; - m_duration = -1; + m_duration = 0; m_lastPosition = 0; #if QT_CONFIG(gstreamer_app) @@ -1455,7 +1455,7 @@ void QGstreamerPlayerSession::updateVideoResolutionTag() void QGstreamerPlayerSession::updateDuration() { gint64 gstDuration = 0; - int duration = -1; + int duration = 0; if (m_playbin && qt_gst_element_query_duration(m_playbin, GST_FORMAT_TIME, &gstDuration)) duration = gstDuration / 1000000; diff --git a/tests/auto/integration/qmediaplayerbackend/BLACKLIST b/tests/auto/integration/qmediaplayerbackend/BLACKLIST index 0a88eef9e..c81f6c24f 100644 --- a/tests/auto/integration/qmediaplayerbackend/BLACKLIST +++ b/tests/auto/integration/qmediaplayerbackend/BLACKLIST @@ -13,7 +13,6 @@ windows 64bit developer-build windows 64bit developer-build [playPauseStop] -linux windows 64bit developer-build [processEOS] diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp index b68bc030a..76b791e21 100644 --- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp +++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp @@ -391,8 +391,8 @@ void tst_QMediaPlayerBackend::playPauseStop() QTest::qWait(2000); - QVERIFY(qAbs(player.position() - positionBeforePause) < 100); - QCOMPARE(positionSpy.count(), 0); + QVERIFY(qAbs(player.position() - positionBeforePause) < 150); + QCOMPARE(positionSpy.count(), 1); stateSpy.clear(); statusSpy.clear(); |