Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(861)

Unified Diff: content/browser/renderer_host/media/audio_renderer_host.cc

Issue 1172883003: Fix for undesired audio blip when closing a muted tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix crash on Windows (grab pointer before scoped_ptr is passed). Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698