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

Unified Diff: content/renderer/media/media_stream_impl.cc

Issue 23449012: Close the shared audio output device when the tab is closed. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 4 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/renderer/media/media_stream_impl.cc
diff --git a/content/renderer/media/media_stream_impl.cc b/content/renderer/media/media_stream_impl.cc
index 6ce995e26084d8352e8a833bf1ae3f7ff7e43421..9eab908f5f90e64927df8e065b0a605a71145c31 100644
--- a/content/renderer/media/media_stream_impl.cc
+++ b/content/renderer/media/media_stream_impl.cc
@@ -552,6 +552,19 @@ void MediaStreamImpl::FrameWillClose(WebKit::WebFrame* frame) {
++request_it;
}
}
+
+ // Free the potentially-cached audio renderer. If we don't do this, the
+ // audio device will be held open after the tab has been closed even though
+ // it's not being used.
+ WebRtcAudioDeviceImpl* audio_device =
+ dependency_factory_->GetWebRtcAudioDevice();
+ if (audio_device) {
+ scoped_refptr<WebRtcAudioRenderer> renderer(audio_device->renderer());
+ if (renderer.get()) {
+ renderer->Stop(); // This will clear the dependency factory's pointer.
+ DCHECK(!audio_device->renderer().get());
+ }
+ }
}
scoped_refptr<VideoFrameProvider>
« 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