Bug 1309162 - part5 : only set the audible state when stream starts playing. draft
authorAlastor Wu <alwu@mozilla.com>
Tue, 29 Nov 2016 12:40:43 +0800
changeset 445137 d0bb75fa673d31ccff4ed616dfc0cc099206fa05
parent 445136 9f72a36bee8b001daa3ba219cdb5b9b9b5600f62
child 445138 51b51a9f9fe4fb1ad9823dd6f50f5b8883bbb821
push id37425
push useralwu@mozilla.com
push dateTue, 29 Nov 2016 05:50:50 +0000
bugs1309162
milestone53.0a1
Bug 1309162 - part5 : only set the audible state when stream starts playing. 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;