Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-128159

QFFmpegMediaPlayer setMedia assert failure

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7.2
    • Multimedia
    • None
    • Edition Windows 10 Education
      Version 22H2
      Installed on ‎26/‎10/‎2020
      OS build 19045.4651
      Experience Windows Feature Experience Pack 1000.19060.1000.0

      Qt from vcpkg
      Shared Qt, shared FFmpeg.
    • Windows
    • Multimedia wk 35-37

    Description

      I have a MediaPlayer in QML that I use to play sound files for items in my menu. The code is at the bottom of this description.

      When I swipe in the menu, the source of the player changes to the sound file of the current item. Sometimes, the item does not have a sound - then I assign "" to source. It is possible for the sound file not to exist on the disk.

      When I switched to the FFmpeg backend on Windows for ogg support, I started getting assertion errors when scrolling through my menu. The assert that triggers is in setMediaAsync of QFFmpegMediaPlayer, at the first line:

      Q_ASSERT(mediaStatus() == QMediaPlayer::LoadingMedia);

      The value of mediaStatus() is QMediaPlayer::NoMedia.

      The value of cancelToken, checked in the next line of code, is true. So the function exits immediately after this assert anyway, causing no apparent issues on a release build.

      It seems probable to me that the media status changed between setMedia }}and {{setMediaAsync and the assert fails to handle that properly. 

       

      My QML code:

      MediaPlayer {
          id: playMusic
      
          property bool waitingForStop: false
      
          loops: MediaPlayer.Infinite
          source: {
              let base = songList.current instanceof ChartData ? PreviewFilePathFetcher.getPreviewFilePath(songList.current.chartDirectory) : ""
              if (base === "") {
                  return base;
              }
              if (base[0] !== '/') {
                  base = '/' + base;
              }
              return "file://" + base;
          }
      
          audioOutput: AudioOutput {
              id: audioOutput
      
          }
      
          onSourceChanged: {
              playMusic.stop();
              previewDelayTimer.stop();
              waitingForStop = playMusic.source !== "";
          }
      }
      Connections {
          function onMovingChanged() {
              if (playMusic.waitingForStop) {
                  previewDelayTimer.restart();
              }
          }
      
          target: songList
      }
      Timer {
          id: previewDelayTimer
      
          interval: 300
      
          onTriggered: {
              playMusic.play();
          }
      }

       

       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-128159
          # Subject Branch Project Status CR V

          Activity

            People

              lars.sutterud Lars Sutterud
              bobini Tomasz Kalisiak
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change