Bug 1109614 - Part 2: TextTrackManager now fires cues before checking for videoFrame. r=rillian
☠☠ backed out by f19eaabb3958 ☠ ☠
authorRuxton <ruxton@thefrontiergroup.com.au>
Tue, 22 Mar 2016 13:55:34 -0700
changeset 289894 6b034852b39fb66515bd80027ee5ab688a9ed60f
parent 289893 529a82416338d2c2e5f5c585ea06269bdc109c77
child 289895 d9667017bada304df6292078ddc899970e597c38
push id18337
push usercbook@mozilla.com
push dateWed, 23 Mar 2016 15:30:25 +0000
treeherderfx-team@67ac681f7e53 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1109614
milestone48.0a1
Bug 1109614 - Part 2: TextTrackManager now fires cues before checking for videoFrame. r=rillian MozReview-Commit-ID: FPz614hnDiF
dom/html/TextTrackManager.cpp
--- a/dom/html/TextTrackManager.cpp
+++ b/dom/html/TextTrackManager.cpp
@@ -195,30 +195,32 @@ TextTrackManager::DidSeek()
 
 void
 TextTrackManager::UpdateCueDisplay()
 {
   if (!mMediaElement || !mTextTracks) {
     return;
   }
 
+  // Cues must be updated regardless before checking for the presence of a video
+  // frame so that Audio tracks get updated cues and fire cuechanges.
+  nsTArray<RefPtr<TextTrackCue> > activeCues;
+  mTextTracks->UpdateAndGetShowingCues(activeCues);
+
   nsIFrame* frame = mMediaElement->GetPrimaryFrame();
   nsVideoFrame* videoFrame = do_QueryFrame(frame);
   if (!videoFrame) {
     return;
   }
 
   nsCOMPtr<nsIContent> overlay = videoFrame->GetCaptionOverlay();
   if (!overlay) {
     return;
   }
 
-  nsTArray<RefPtr<TextTrackCue> > activeCues;
-  mTextTracks->UpdateAndGetShowingCues(activeCues);
-
   if (activeCues.Length() > 0) {
     RefPtr<nsVariantCC> jsCues = new nsVariantCC();
 
     jsCues->SetAsArray(nsIDataType::VTYPE_INTERFACE,
                        &NS_GET_IID(nsIDOMEventTarget),
                        activeCues.Length(),
                        static_cast<void*>(activeCues.Elements()));