AVFoundation: fix rendering when player reached EndOfMedia.

Once the media player reached the end of the media, it shouldn't be
rendering frames anymore. This could happen when seeking after reaching
the end.
The output layer is now cleared on EndOfMedia to make sure that doesn't
happen.

Change-Id: I18a21eaff6c63a2bd54d4c2953f89eb1722f66d5
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
This commit is contained in:
Yoann Lopes
2015-09-04 14:59:55 +02:00
parent fdac8d9c74
commit e9cf6670fe

View File

@@ -767,6 +767,11 @@ void AVFMediaPlayerSession::processEOS()
Q_EMIT positionChanged(position());
m_mediaStatus = QMediaPlayer::EndOfMedia;
// At this point, frames should not be rendered anymore.
// Clear the output layer to make sure of that.
if (m_videoOutput)
m_videoOutput->setLayer(0);
Q_EMIT stateChanged(m_state = QMediaPlayer::StoppedState);
Q_EMIT mediaStatusChanged(m_mediaStatus);
}