Index: content/browser/renderer_host/render_process_host_impl.cc |
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
index 79eeee2ffcf4a1e6665a8871fc4bfd83e2e16baa..3d2365ef8f02b44780c2842b9ff17115a3d4ef6b 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -1572,7 +1572,14 @@ int RenderProcessHostImpl::VisibleWidgetCount() const { |
return visible_widgets_; |
} |
-void RenderProcessHostImpl::AudioStateChanged() { |
+void RenderProcessHostImpl::OnAudioStreamAdded() { |
+ ++audio_stream_count_; |
+ UpdateProcessPriority(); |
+} |
+ |
+void RenderProcessHostImpl::OnAudioStreamRemoved() { |
+ DCHECK_GT(audio_stream_count_, 0); |
+ --audio_stream_count_; |
UpdateProcessPriority(); |
} |
@@ -2831,7 +2838,7 @@ void RenderProcessHostImpl::UpdateProcessPriority() { |
// visible widgets -- the callers must call this function whenever we |
// transition in/out of those states. |
const bool should_background = |
- visible_widgets_ == 0 && !audio_renderer_host_->HasActiveAudio() && |
+ visible_widgets_ == 0 && audio_stream_count_ == 0 && |
!base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kDisableRendererBackgrounding); |