Bug 1343465 - part1 : check audio track to decide the audible state when the media element was muted. r=baku
authorAlastor Wu <alwu@mozilla.com>
Sat, 04 Mar 2017 16:51:12 +0800
changeset 374953 05312b954500198ffde27f4efe4c1d2205e14d93
parent 374952 9f89c64ea95ad89a3ae3c81b3b608db8301ede25
child 374954 60d90be2e7bc6c6bd961c95fe3feae26ebe011c2
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1343465
milestone54.0a1
Bug 1343465 - part1 : check audio track to decide the audible state when the media element was muted. r=baku If the media starts after muting the tab, IsOwnerAudible() would always return "eNotAudible". It causes that the "play tab" icon can't be displayed because we only show the "play tab" icon for the "eMaybeAudible" or "eAudible". We should check whether owner owns the audio track to decide the return value. MozReview-Commit-ID: DGwkArx0a4R
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -993,17 +993,19 @@ private:
             mSuspended == nsISuspendedTypes::SUSPENDED_BLOCK);
   }
 
   AudibleState
   IsOwnerAudible() const
   {
     // Muted or the volume should not be ~0
     if (mOwner->mMuted || (std::fabs(mOwner->Volume()) <= 1e-7)) {
-      return AudioChannelService::AudibleState::eNotAudible;
+      return mOwner->HasAudio() ?
+        AudioChannelService::AudibleState::eMaybeAudible :
+        AudioChannelService::AudibleState::eNotAudible;
     }
 
     // No audio track.
     if (!mOwner->HasAudio()) {
       return AudioChannelService::AudibleState::eNotAudible;
     }
 
     // Might be audible but not yet.