Bug 1325004. Part 5 - let BufferingState call Push{Audio,Video} instead. r?kikuo
BufferingState will call DispatchDecodeTasksIfNeeded() if not done buffering.
MozReview-Commit-ID: Kzqqn8lXPLm
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -1545,25 +1545,25 @@ public:
{
return DECODER_STATE_BUFFERING;
}
void HandleAudioDecoded(MediaData* aAudio) override
{
// This might be the sample we need to exit buffering.
// Schedule Step() to check it.
- mMaster->Push(aAudio);
+ mMaster->PushAudio(aAudio);
mMaster->ScheduleStateMachine();
}
void HandleVideoDecoded(MediaData* aVideo, TimeStamp aDecodeStart) override
{
// This might be the sample we need to exit buffering.
// Schedule Step() to check it.
- mMaster->Push(aVideo);
+ mMaster->PushVideo(aVideo);
mMaster->ScheduleStateMachine();
}
void HandleEndOfStream() override;
void HandleVideoSuspendTimeout() override
{
if (mMaster->HasVideo()) {
@@ -2158,16 +2158,17 @@ BufferingState::Step()
bool isLiveStream = Resource()->IsLiveStream();
if ((isLiveStream || !mMaster->CanPlayThrough()) &&
elapsed < TimeDuration::FromSeconds(mBufferingWait * mMaster->mPlaybackRate) &&
mMaster->HasLowBufferedData(mBufferingWait * USECS_PER_S) &&
IsExpectingMoreData()) {
SLOG("Buffering: wait %ds, timeout in %.3lfs",
mBufferingWait, mBufferingWait - elapsed.ToSeconds());
mMaster->ScheduleStateMachineIn(USECS_PER_S);
+ mMaster->DispatchDecodeTasksIfNeeded();
return;
}
} else if (mMaster->OutOfDecodedAudio() || mMaster->OutOfDecodedVideo()) {
MOZ_ASSERT(Reader()->IsWaitForDataSupported(),
"Don't yet have a strategy for non-heuristic + non-WaitForData");
mMaster->DispatchDecodeTasksIfNeeded();
MOZ_ASSERT(mMaster->mMinimizePreroll ||
!mMaster->OutOfDecodedAudio() ||