Bug 1309162 - part5 : only set the audible state when stream starts playing. r=baku
authorAlastor Wu <alwu@mozilla.com>
Tue, 29 Nov 2016 12:40:43 +0800
changeset 324592 583e3edec539669eb7d6c193d25f721c94328e0e
parent 324591 67431dae9ec80e2d1651e1ae1baca1423462cb08
child 324593 eef982c27c7b481178fa5f8776dd1e6fbb17ab81
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;