Commit 04eb0d22 authored by miu's avatar miu Committed by Commit bot

Fix for undesired audio blip when closing a muted tab.

AudioRendererHost was calling AudioMirroringManager::RemoveDiverter()
just before AudioOutputController::Close().  This caused AOC to re-start
the default audio output stream (to the user's speakers) for 0-50+
milliseconds before closing and shutting down.  This change fixes the
problem by moving the RemoveDiverter() call to a point after AOC has
completed its close operation, which results in no new streams starting
up during this shutdown process.

BUG=474432

Review URL: https://codereview.chromium.org/1172883003

Cr-Commit-Position: refs/heads/master@{#333684}
parent 0bd2b9ee
......@@ -439,8 +439,6 @@ void AudioRendererHost::OnCloseStream(int stream_id) {
audio_entries_.erase(i);
media::AudioOutputController* const controller = entry->controller();
if (mirroring_manager_)
mirroring_manager_->RemoveDiverter(controller);
controller->Close(
base::Bind(&AudioRendererHost::DeleteEntry, this, base::Passed(&entry)));
audio_log_->OnClosed(stream_id);
......@@ -448,6 +446,15 @@ void AudioRendererHost::OnCloseStream(int stream_id) {
void AudioRendererHost::DeleteEntry(scoped_ptr<AudioEntry> entry) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
// De-register the controller from the AudioMirroringManager now that the
// controller has closed the AudioOutputStream and shut itself down. This
// ensures that calling RemoveDiverter() here won't trigger the controller to
// re-start the default AudioOutputStream and cause a brief audio blip to come
// out the user's speakers. http://crbug.com/474432
if (mirroring_manager_)
mirroring_manager_->RemoveDiverter(entry->controller());
AudioStreamMonitor::StopMonitoringStream(
render_process_id_, entry->render_frame_id(), entry->stream_id());
UpdateNumPlayingStreams(entry.get(), false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment