Bug 1313548: P3. Return early of we're not longer waiting for a key. r?gerald
The next run of Update would have cleared the mWaitingForKey flag, may as well do it early.
MozReview-Commit-ID: DXiqSDAxnnz
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -1717,16 +1717,17 @@ MediaFormatReader::NotifyWaitingForKey(T
{
MOZ_ASSERT(OnTaskQueue());
auto& decoder = GetDecoderData(aTrack);
if (mDecoder) {
mDecoder->NotifyWaitingForKey();
}
if (!decoder.mDecodeRequest.Exists()) {
LOGV("WaitingForKey received while no pending decode. Ignoring");
+ return;
}
decoder.mWaitingForKey = true;
ScheduleUpdate(aTrack);
}
void
MediaFormatReader::NotifyEndOfStream(TrackType aTrack)
{
--- a/dom/media/MediaFormatReader.h
+++ b/dom/media/MediaFormatReader.h
@@ -383,17 +383,17 @@ private:
}
bool CancelWaitingForKey()
{
if (!mWaitingForKey) {
return false;
}
mWaitingForKey = false;
- if (IsWaiting() || mWaitingPromise.IsEmpty()) {
+ if (IsWaiting() || !HasWaitingPromise()) {
return false;
}
mWaitingPromise.Resolve(mType, __func__);
return true;
}
// Reset the state of the DecoderData, clearing all queued frames
// (pending demuxed and decoded).