Bug 1351087 - part1 : don't register agent for audio without audio track. r=baku a=gchang
authorAlastor Wu <alwu@mozilla.com>
Tue, 09 May 2017 14:10:43 +0800
changeset 396348 659ecca63ea66d76d26eb366030b4c43c2c6e786
parent 396347 0241994e3aad3594cae0d42c7d80a2dff7b245e8
child 396349 2adc92ca880875a4728d3499154a76fadcadfa0a
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, gchang
bugs1351087
milestone54.0
Bug 1351087 - part1 : don't register agent for audio without audio track. r=baku a=gchang Since we don't want to show media control for media without audio track (eg. GIFV), it's no need to register audio agent for them. MozReview-Commit-ID: 22YrMkpNrcP
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1043,16 +1043,21 @@ private:
       return true;
     }
 
     // Are we paused
     if (mOwner->mPaused) {
       return false;
     }
 
+    // No audio track
+    if (!mOwner->HasAudio()) {
+      return false;
+    }
+
     // A loop always is playing
     if (mOwner->HasAttr(kNameSpaceID_None, nsGkAtoms::loop)) {
       return true;
     }
 
     // If we are actually playing...
     if (mOwner->IsCurrentlyPlaying()) {
       return true;
@@ -7095,16 +7100,17 @@ HTMLMediaElement::ShouldElementBePaused(
 }
 
 void
 HTMLMediaElement::SetMediaInfo(const MediaInfo& aInfo)
 {
   const bool oldHasAudio = mMediaInfo.HasAudio();
   mMediaInfo = aInfo;
   if (aInfo.HasAudio() != oldHasAudio) {
+    UpdateAudioChannelPlayingState();
     NotifyAudioPlaybackChanged(
       AudioChannelService::AudibleChangedReasons::eDataAudibleChanged);
   }
   if (mAudioChannelWrapper) {
     mAudioChannelWrapper->AudioCaptureStreamChangeIfNeeded();
   }
 }