Commit 0a6f22db authored by VaL Doroshchuk's avatar VaL Doroshchuk
Browse files

AVF: Emit StalledMedia when unbuffered and resume playback afterwards


If remote source is requested to play but there is a limitation in network bandwidth,
StalledMedia status is never emitted, also the playback is not resumed after buffer gets full again.

Based on AVPlayerItem.playbackLikelyToKeepUp introduced changing the media status
and resuming the playback.

Task-number: QTBUG-49806
Change-Id: If8aa10a1ea2cee2a40c679871b836d2dca622fcd
Reviewed-by: default avatarVille Voutilainen <ville.voutilainen@qt.io>
Showing with 13 additions and 0 deletions
...@@ -922,6 +922,19 @@ void AVFMediaPlayerSession::processBufferStateChange(int bufferStatus) ...@@ -922,6 +922,19 @@ void AVFMediaPlayerSession::processBufferStateChange(int bufferStatus)
if (bufferStatus == m_bufferStatus) if (bufferStatus == m_bufferStatus)
return; return;
auto status = m_mediaStatus;
// Buffered -> unbuffered.
if (!bufferStatus) {
status = QMediaPlayer::StalledMedia;
} else if (status == QMediaPlayer::StalledMedia) {
status = QMediaPlayer::BufferedMedia;
// Resume playback.
[[static_cast<AVFMediaPlayerSessionObserver*>(m_observer) player] setRate:m_rate];
}
if (m_mediaStatus != status)
Q_EMIT mediaStatusChanged(m_mediaStatus = status);
m_bufferStatus = bufferStatus; m_bufferStatus = bufferStatus;
Q_EMIT bufferStatusChanged(bufferStatus); Q_EMIT bufferStatusChanged(bufferStatus);
} }
......
Supports Markdown
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