Bug 1090991 - Introduce a new NotDecodedReason WAITING_FOR_DATA and use it for MSE. r=cpearce,r=cajbir

This commit is contained in:
Bobby Holley 2014-11-03 09:20:15 +01:00
parent 4482a8ac0f
commit 56a6b50f23
3 changed files with 15 additions and 4 deletions

View File

@ -257,7 +257,8 @@ public:
enum NotDecodedReason {
END_OF_STREAM,
DECODE_ERROR
DECODE_ERROR,
WAITING_FOR_DATA
};
// Receives the result of a RequestAudioData() call.

View File

@ -818,6 +818,12 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType,
return;
}
// If the decoder is waiting for data, there's nothing more to do after
// clearing the pending request.
if (aReason == RequestSampleCallback::WAITING_FOR_DATA) {
return;
}
// This is an EOS. Finish off the queue, and then handle things based on our
// state.
MOZ_ASSERT(aReason == RequestSampleCallback::END_OF_STREAM);

View File

@ -167,7 +167,7 @@ MediaSourceReader::OnNotDecoded(MediaData::Type aType, RequestSampleCallback::No
return;
}
MOZ_ASSERT(aReason == RequestSampleCallback::END_OF_STREAM);
// See if we can find a different reader that can pick up where we left off.
if (aType == MediaData::AUDIO_DATA && SwitchAudioReader(mLastAudioTime)) {
RequestAudioData();
return;
@ -177,11 +177,15 @@ MediaSourceReader::OnNotDecoded(MediaData::Type aType, RequestSampleCallback::No
return;
}
// If the entire MediaSource is done, generate an EndOfStream.
if (IsEnded()) {
GetCallback()->OnNotDecoded(aType, aReason);
GetCallback()->OnNotDecoded(aType, RequestSampleCallback::END_OF_STREAM);
return;
}
// Drop anything else on the floor. This gets fixed in the next patch.
// We don't have the data the caller wants. Tell that we're waiting for JS to
// give us more data.
GetCallback()->OnNotDecoded(aType, RequestSampleCallback::WAITING_FOR_DATA);
}
void