Bug 1309162 - part5 : only set the audible state when stream starts playing. r=baku
☠☠ backed out by eb95159069bb ☠ ☠
authorAlastor Wu <alwu@mozilla.com>
Sat, 26 Nov 2016 02:35:20 +0800
changeset 324528 2015de6577af9b626dad5576e92120bccb59e719
parent 324527 fe1771c913099ef108b6f856cb7fa6e19bfc0c5f
child 324529 17c744162fbe53642a4d88848098d12c80f97bd4
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbaku
bugs1309162
milestone53.0a1
Bug 1309162 - part5 : only set the audible state when stream starts playing. r=baku If input is a media stream, we would always regard it as audible when it's playing. We won't need to set it as non-audible. MozReview-Commit-ID: 8mzTsAkt6lG
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4633,16 +4633,19 @@ void HTMLMediaElement::UpdateSrcMediaStr
     SetVolumeInternal();
 
     VideoFrameContainer* container = GetVideoFrameContainer();
     if (mSelectedVideoStreamTrack && container) {
       mSelectedVideoStreamTrack->AddVideoOutput(container);
     }
 
     SetCapturedOutputStreamsEnabled(true); // Unmute
+    // If the input is a media stream, we don't check its data and always regard
+    // it as audible when it's playing.
+    SetAudibleState(true);
   } else {
     if (stream) {
       mSrcStreamPausedCurrentTime = CurrentTime();
 
       stream->RemoveListener(mMediaStreamListener);
 
       stream->RemoveAudioOutput(this);
       VideoFrameContainer* container = GetVideoFrameContainer();
@@ -4656,20 +4659,16 @@ void HTMLMediaElement::UpdateSrcMediaStr
     // called and that will remove all listeners/outputs.
 
     mWatchManager.Unwatch(*mMediaStreamListener,
         &HTMLMediaElement::UpdateReadyStateInternal);
 
     mMediaStreamListener->Forget();
     mMediaStreamListener = nullptr;
   }
-
-  // If the input is a media stream, we don't check its data and always regard
-  // it as audible when it's playing.
-  SetAudibleState(shouldPlay);
 }
 
 void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream)
 {
   NS_ASSERTION(!mSrcStream && !mMediaStreamListener && !mMediaStreamSizeListener,
                "Should have been ended already");
 
   mSrcStream = aStream;