Details
-
Bug
-
Resolution: Cannot Reproduce
-
P3: Somewhat important
-
None
-
5.12.4, 5.12.5, 5.12.6
-
None
Description
I have a custom AudioQueue class, that can add new files to the playlist, or throw everything away if the end of the playlist is reached. The latter is done by waiting for currentIndexChanged signal sending -1. Since this sometimes just doesn't progress anymore I have the following debug code added:
connect(m_MediaPlayer, &QMediaPlayer::stateChanged, [] (auto s) { qDebug() << __PRETTY_FUNCTION__ << s; }); connect(m_MediaPlayer, &QMediaPlayer::mediaStatusChanged, [] (auto s) { qDebug() << __PRETTY_FUNCTION__ << s; });
Another function dumppl() will dump the playlist contents and player state at several points. Now the following sequence happens:
Thread 0x7fffd8d38700 (LWP 2753) exited] AudioQueue::AudioQueue(QObject*)::<lambda(auto:3)> [with auto:3 = QMediaPlayer::MediaStatus] QMediaPlayer::LoadingMedia [New Thread 0x7fffd8d38700 (LWP 2754)] AudioQueue::AudioQueue(QObject*)::<lambda(auto:3)> [with auto:3 = QMediaPlayer::MediaStatus] QMediaPlayer::BufferedMedia AudioQueue::AudioQueue(QObject*)::<lambda(auto:3)> [with auto:3 = QMediaPlayer::MediaStatus] QMediaPlayer::EndOfMedia void AudioQueue::playlistIndexChanged(int) 7 7 QMediaPlayer::StoppedState QMediaPlayer::EndOfMedia QUrl("file:///mnt/Data/tfi3_0.wav") void dumppl(const QMediaPlayer*) 6 QUrl("file:///mnt/Data/tfi3_0.wav") void dumppl(const QMediaPlayer*) 7 QUrl("file:///mnt/Data/tfi2_0.wav") void dumppl(const QMediaPlayer*) 8 QUrl("file:///mnt/Data/tfi5_0.wav") void dumppl(const QMediaPlayer*) 9 QUrl("file:///mnt/Data/tfi4_0.wav") // this is the last "good" transition, i.e. the next song is actually played [Thread 0x7fffd8d38700 (LWP 2754) exited] AudioQueue::AudioQueue(QObject*)::<lambda(auto:3)> [with auto:3 = QMediaPlayer::MediaStatus] QMediaPlayer::LoadingMedia [New Thread 0x7fffd8d38700 (LWP 2755)] AudioQueue::AudioQueue(QObject*)::<lambda(auto:3)> [with auto:3 = QMediaPlayer::MediaStatus] QMediaPlayer::BufferedMedia AudioQueue::AudioQueue(QObject*)::<lambda(auto:3)> [with auto:3 = QMediaPlayer::MediaStatus] QMediaPlayer::EndOfMedia void AudioQueue::playlistIndexChanged(int) 8 8 QMediaPlayer::StoppedState QMediaPlayer::EndOfMedia QUrl("file:///mnt/Data/tfi2_0.wav") void dumppl(const QMediaPlayer*) 7 QUrl("file:///mnt/Data/tfi2_0.wav") void dumppl(const QMediaPlayer*) 8 QUrl("file:///mnt/Data/tfi5_0.wav") void dumppl(const QMediaPlayer*) 9 QUrl("file:///mnt/Data/tfi4_0.wav") void dumppl(const QMediaPlayer*) 10 QUrl("file:///mnt/Data/tfi2_0.wav") // this happens when the song finished playing, but nothing happens here anymore [Thread 0x7fffd8d38700 (LWP 2755) exited] AudioQueue::AudioQueue(QObject*)::<lambda(auto:3)> [with auto:3 = QMediaPlayer::MediaStatus] QMediaPlayer::LoadingMedia [New Thread 0x7fffd8d38700 (LWP 2756)] AudioQueue::AudioQueue(QObject*)::<lambda(auto:3)> [with auto:3 = QMediaPlayer::MediaStatus] QMediaPlayer::LoadedMedia // now a different caller comes and checks if the queue is empty, and since it is not, does not modify it bool AudioQueue::empty() const 8 QMediaPlayer::PlayingState QMediaPlayer::LoadedMedia QUrl("file:///mnt/Data/tfi5_0.wav") void dumppl(const QMediaPlayer*) 7 QUrl("file:///mnt/Data/tfi2_0.wav") void dumppl(const QMediaPlayer*) 8 QUrl("file:///mnt/Data/tfi5_0.wav") void dumppl(const QMediaPlayer*) 9 QUrl("file:///mnt/Data/tfi4_0.wav") void dumppl(const QMediaPlayer*) 10 QUrl("file:///mnt/Data/tfi2_0.wav")
dumppl() looks like this, I have only truncated the lists above for sanity:
static void dumppl(const QMediaPlayer *p) { qDebug() << p->playlist()->currentIndex() << p->state() << p->mediaStatus() << p->currentMedia().canonicalUrl(); auto &&pl = p->playlist(); for (int i = 0; i < pl->mediaCount(); i++) qDebug() << __PRETTY_FUNCTION__ << i << pl->media(i).canonicalUrl(); }
Reproducing takes some time, i.e. I have to put things in the queue, let it run empty and so on, but after ~2 minutes I get to break it usually. The WAV files used here play only for a few seconds.