WMF: fixed MediaPlayer buffering logic.
To have a consistent behavior with other backends, the WMF plugin now starts the session after loading a media in order to start buffering some data and correctly notify when the media is buffered. It was previously reporting a BufferedMedia status only (and wrongly) after explicitly starting the media player. Not all source readers (usually a source reader is specific to a file format) implement the service needed to query buffering progress. In that case just report the media to be buffered immediately after loading. Change-Id: I6e6332ae08e96fc789556761e5169b88c36c5e37 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
e15a2b92b6
commit
d599f7319a
@@ -1326,8 +1326,6 @@ void MFPlayerSession::start()
|
|||||||
switch (m_status) {
|
switch (m_status) {
|
||||||
case QMediaPlayer::EndOfMedia:
|
case QMediaPlayer::EndOfMedia:
|
||||||
m_varStart.hVal.QuadPart = 0;
|
m_varStart.hVal.QuadPart = 0;
|
||||||
//since it must be loaded already, just fallthrough
|
|
||||||
case QMediaPlayer::LoadedMedia:
|
|
||||||
changeStatus(QMediaPlayer::BufferedMedia);
|
changeStatus(QMediaPlayer::BufferedMedia);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1911,10 +1909,12 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent)
|
|||||||
|
|
||||||
switch (meType) {
|
switch (meType) {
|
||||||
case MEBufferingStarted:
|
case MEBufferingStarted:
|
||||||
changeStatus(QMediaPlayer::StalledMedia);
|
changeStatus(m_status == QMediaPlayer::LoadedMedia ? QMediaPlayer::BufferingMedia : QMediaPlayer::StalledMedia);
|
||||||
emit bufferStatusChanged(bufferStatus());
|
emit bufferStatusChanged(bufferStatus());
|
||||||
break;
|
break;
|
||||||
case MEBufferingStopped:
|
case MEBufferingStopped:
|
||||||
|
if (m_status == QMediaPlayer::BufferingMedia)
|
||||||
|
stop(true);
|
||||||
changeStatus(QMediaPlayer::BufferedMedia);
|
changeStatus(QMediaPlayer::BufferedMedia);
|
||||||
emit bufferStatusChanged(bufferStatus());
|
emit bufferStatusChanged(bufferStatus());
|
||||||
break;
|
break;
|
||||||
@@ -1979,6 +1979,16 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
MFGetService(m_session, MFNETSOURCE_STATISTICS_SERVICE, IID_PPV_ARGS(&m_netsourceStatistics));
|
MFGetService(m_session, MFNETSOURCE_STATISTICS_SERVICE, IID_PPV_ARGS(&m_netsourceStatistics));
|
||||||
|
|
||||||
|
if (!m_netsourceStatistics || bufferStatus() == 100) {
|
||||||
|
// If the source reader doesn't implement the statistics service, just set the status
|
||||||
|
// to buffered, since there is no way to query the buffering progress...
|
||||||
|
changeStatus(QMediaPlayer::BufferedMedia);
|
||||||
|
} else {
|
||||||
|
// Start to trigger buffering. Once enough buffering is done, the session will
|
||||||
|
// be automatically stopped unless the user has explicitly started playback.
|
||||||
|
start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user