Bug 1312886: P7. Handle case where nextFrameStatus jumps straight to NEXT_FRAME_UNAVAILABLE_BUFFERING. r=jwwang
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 27 Oct 2016 21:12:20 +1100
changeset 319926 09371a75ac7e3122e5ebe7154d1c3c89300b7d52
parent 319925 76f8b94d7b66cf573ff5654d31bc5d16e9b40b1f
child 319927 5e28fc45d1364e909cbefbf078ba2ea3b26eeb53
push id20749
push userryanvm@gmail.com
push dateSat, 29 Oct 2016 13:21:21 +0000
treeherderfx-team@1b170b39ed6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1312886
milestone52.0a1
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
dom/html/HTMLMediaElement.cpp
--- 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"));