diff options
author | Lars Knoll <lars.knoll@qt.io> | 2022-03-11 11:53:37 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2022-04-04 10:20:44 +0200 |
commit | 3908599ece07311986dae2d65af56ee62a707b91 (patch) | |
tree | 0f32fde5c806401fee61540052da02f743025a68 /tests | |
parent | 262b6821548d423677577f325b8f37fab2fc70c8 (diff) |
Fix issues with detecting the end of playback
Store the duration in usecs, and tell the media player we're done
once we're within 10ms of the end of the stream. The 10ms jitter
is there to help with rounding errors when resampling the audio
stream.
In addition some cleanups removing things we don't use anymore.
Change-Id: Ib22e216c90766f411daa7df7c5148ddfc87c445b
Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp index 7abdea8cc..cc5f22043 100644 --- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp +++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp @@ -522,6 +522,10 @@ void tst_QMediaPlayerBackend::processEOS() QVERIFY(statusSpy.count() > 0); QCOMPARE(statusSpy.last()[0].value<QMediaPlayer::MediaStatus>(), QMediaPlayer::BufferedMedia); + positionSpy.clear(); + QTRY_VERIFY(player.position() > 100); + QTRY_VERIFY(positionSpy.count() > 0); + QVERIFY(positionSpy.last()[0].value<qint64>() > 100); player.setPosition(900); //wait up to 5 seconds for EOS QTRY_COMPARE(player.mediaStatus(), QMediaPlayer::EndOfMedia); @@ -615,6 +619,7 @@ void tst_QMediaPlayerBackend::deleteLaterAtEOS() QPointer<QMediaPlayer> player(new QMediaPlayer); QAudioOutput output; player->setAudioOutput(&output); + player->setPosition(800); // don't wait as long for EOS DeleteLaterAtEos deleter(player); player->setSource(localWavFile); @@ -623,7 +628,7 @@ void tst_QMediaPlayerBackend::deleteLaterAtEOS() // DeferredDelete events during the wait, which interferes with this test. QEventLoop loop; QTimer::singleShot(0, &deleter, SLOT(play())); - QTimer::singleShot(1500, &loop, SLOT(quit())); + QTimer::singleShot(5000, &loop, SLOT(quit())); connect(player.data(), SIGNAL(destroyed()), &loop, SLOT(quit())); loop.exec(); // Verify that the player was destroyed within the event loop. |