Bug 1580659 - part3 : call 'WindowAudioCaptureChanged()' explicitly. r=chunmin,karlt

Previously `AudioChannelService` called `WindowAudioCaptureChanged()` implicitly whenever we added the agent to the service [1], which made the audio capturing callback happen before finishing registration.

There are two drawbacks,
(1) it's hard to be aware of that the audio capturing callback would be called before finishing `AudioChannelAgent::NotifyStartedPlaying()` [2], which causes unclear call flow.

(2) If someone checks `AudioChannelAgent::IsPlayingStarted()` [3] inside audio capturing callback, then we would find that the `mIsRegToService` is false even if we have registered the agent to `AudioChannelService` because `mIsRegToService` is updated in the last line in the `AudioChannelAgent::NotifyStartedPlaying()`, but the audio capturing callback could be executed before that.

[1] https://searchfox.org/mozilla-central/rev/a777ff11b6d700a698c61e5bd17e73b044304494/dom/audiochannel/AudioChannelService.cpp#723
[2] https://searchfox.org/mozilla-central/rev/a777ff11b6d700a698c61e5bd17e73b044304494/dom/audiochannel/AudioChannelAgent.cpp#144
[3] https://searchfox.org/mozilla-central/rev/a777ff11b6d700a698c61e5bd17e73b044304494/dom/audiochannel/AudioChannelAgent.cpp#285

Differential Revision: https://phabricator.services.mozilla.com/D45750
This commit is contained in:
Alastor Wu
2019-09-18 21:59:32 +00:00
parent 3c4ba7ccdf
commit 0e3717f755
5 changed files with 12 additions and 9 deletions

View File

@@ -1198,6 +1198,7 @@ class HTMLMediaElement::AudioChannelAgentCallback final
NotifyMediaStarted(mAudioChannelAgent->WindowID());
WindowVolumeChanged(config.mVolume, config.mMuted);
WindowSuspendChanged(config.mSuspend);
WindowAudioCaptureChanged(config.mCapturedAudio);
}
void StopAudioChanelAgent() {