Index: content/browser/renderer_host/media/audio_renderer_host.cc |
diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc |
index 5f140ac2b8ff7c4c301552632c5c0b8b9fc5c22a..84798c8d82ea1fd062e4c2d6f00c4148c02a74c3 100644 |
--- a/content/browser/renderer_host/media/audio_renderer_host.cc |
+++ b/content/browser/renderer_host/media/audio_renderer_host.cc |
@@ -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); |