Skip to content
Commit a331366d authored by Bart De Vries's avatar Bart De Vries
Browse files

Replace Audio prepare hack by nicer, asynchronous solution

The main bits of this implementation are:
- Start a new track in paused state.  We don't care about the actual
  media state or player state that QMediaPlayer is reporting.  We will
  deal with that when the audio actually starts playing.
- If a player position needs to be restored, we set d->m_pendingSeek to
  the position that needs to be seeked.  We don't actually seek because
  we have no idea what state the player is in yet.
- On the positionChanged signal of QMP, and if the media is buffered, we
  check if there is pendingSeek value set which is set to a different
  value than the current player position.  If so, we call
  d->m_player.setPosition().  If we have arrived at the correct
  position, then we reset d->m_pendingSeek to -1.
- In the position(), duration() and seek() methods, we return sensible
  values, even QMP is not.  So, we report the duration from the
  enclosure, the position from d->m_pendingSeek, and let seek() change
  the value of d->m_PendingSeek (if it's not -1) to the new seek
  position.
- When there's a pending seek, we set the notifyInterval to shorter
  interval to reduce the startup audio glitch as much as possible.  We
  then reset it to the default of 1000 msec.

This was tested on linux and android.
parent 9539daec
Pipeline #66800 passed with stage
in 8 minutes and 17 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment