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
--- 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;