Bug 998284. When entering the buffering state from AdvanceFrame, be prepared to accept a second's delay before reevaluating whether to exit buffering. r=cpearce
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -2461,17 +2461,20 @@ void MediaDecoderStateMachine::AdvanceFr
HasLowDecodedData(remainingTime + EXHAUSTED_DATA_MARGIN_USECS) &&
!mDecoder->IsDataCachedToEndOfResource() &&
!resource->IsSuspended()) {
if (JustExitedQuickBuffering() || HasLowUndecodedData()) {
if (currentFrame) {
mReader->VideoQueue().PushFront(currentFrame.forget());
}
StartBuffering();
- ScheduleStateMachine();
+ // Don't go straight back to the state machine loop since that might
+ // cause us to start decoding again and we could flip-flop between
+ // decoding and quick-buffering.
+ ScheduleStateMachine(USECS_PER_S);
return;
}
}
// We've got enough data to keep playing until at least the next frame.
// Start playing now if need be.
if (!IsPlaying() && ((mFragmentEndTime >= 0 && clock_time < mFragmentEndTime) || mFragmentEndTime < 0)) {
StartPlayback();