Bug 1207198: P2. Defer dormant request while ReadMetadata is pending in MDSM. r=sotaro

This commit is contained in:
Jean-Yves Avenard 2015-10-21 20:19:42 +11:00
Родитель 3b37e9ab5c
Коммит 16d89e70eb
2 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -1246,6 +1246,18 @@ MediaDecoderStateMachine::SetDormant(bool aDormant)
return;
}
if (mMetadataRequest.Exists()) {
if (mPendingDormant && mPendingDormant.ref() != aDormant && !aDormant) {
// We already have a dormant request pending; the new request would have
// resumed from dormant, we can just cancel any pending dormant requests.
mPendingDormant.reset();
} else {
mPendingDormant = Some(aDormant);
}
return;
}
mPendingDormant.reset();
DECODER_LOG("SetDormant=%d", aDormant);
if (aDormant) {
@ -1906,6 +1918,11 @@ MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata)
MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA);
mMetadataRequest.Complete();
if (mPendingDormant) {
SetDormant(mPendingDormant.ref());
return;
}
// Set mode to PLAYBACK after reading metadata.
mResource->SetReadMode(MediaCacheStream::MODE_PLAYBACK);
mDecoder->DispatchSetMediaSeekable(mReader->IsMediaSeekable());

Просмотреть файл

@ -1086,6 +1086,9 @@ private:
// been written to the MediaStream.
Watchable<bool> mAudioCompleted;
// Set if MDSM receives dormant request during reading metadata.
Maybe<bool> mPendingDormant;
// Flag whether we notify metadata before decoding the first frame or after.
//
// Note that the odd semantics here are designed to replicate the current