Bug 1312886: P7. Handle case where nextFrameStatus jumps straight to NEXT_FRAME_UNAVAILABLE_BUFFERING. r?jwwang
Under some circumstances, we will go from NEXT_FRAME_AVAILABLE to NEXT_FRAME_UNAVAILABLE_BUFFERING directly. We handle this condition now
MozReview-Commit-ID: JVAQhsgzSp2
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4702,17 +4702,19 @@ HTMLMediaElement::UpdateReadyStateIntern
}
if (hasVideoTracks) {
mediaInfo.EnableVideo();
}
MetadataLoaded(&mediaInfo, nsAutoPtr<const MetadataTags>(nullptr));
}
enum NextFrameStatus nextFrameStatus = NextFrameStatus();
- if (nextFrameStatus == NEXT_FRAME_UNAVAILABLE) {
+ if (nextFrameStatus == NEXT_FRAME_UNAVAILABLE ||
+ (nextFrameStatus == NEXT_FRAME_UNAVAILABLE_BUFFERING &&
+ mWaitingForKey == WAITING_FOR_KEY)) {
if (mWaitingForKey != NOT_WAITING_FOR_KEY) {
// http://w3c.github.io/encrypted-media/#wait-for-key
// Continuing 7.3.4 Queue a "waitingforkey" Event
// 4. Queue a task to fire a simple event named waitingforkey
// at the media element.
if (mWaitingForKey == WAITING_FOR_KEY) {
mWaitingForKey = WAITING_FOR_KEY_DISPATCHED;
DispatchAsyncEvent(NS_LITERAL_STRING("waitingforkey"));