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> |