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

Unified Diff: content/browser/media/audio_stream_monitor.cc

Issue 2655413004: Strip out stream counting from AudioRendererHost. (Closed)
Patch Set: Created 3 years, 11 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
Index: content/browser/media/audio_stream_monitor.cc
diff --git a/content/browser/media/audio_stream_monitor.cc b/content/browser/media/audio_stream_monitor.cc
index ba86d56a8f05f5b8c1ba9bc5d8e3f581b7d3f96a..3f1c09a4c4c8b6a8c40715c7c1cb4d760aa0499e 100644
--- a/content/browser/media/audio_stream_monitor.cc
+++ b/content/browser/media/audio_stream_monitor.cc
@@ -87,6 +87,12 @@ void AudioStreamMonitor::StartMonitoringHelper(
if (!monitor)
return;
+ RenderProcessHostImpl* render_process_host =
DaleCurtis 2017/01/30 21:12:19 +ncarter for content/ review. Is it possible for t
ncarter (slow) 2017/01/31 18:33:12 This is safe, given the implementation of AudioStr
DaleCurtis 2017/02/06 22:19:02 Replaced all of this with a helper function. We ca
+ static_cast<RenderProcessHostImpl*>(
+ RenderProcessHost::FromID(render_process_id));
+ if (!render_process_host)
+ return;
+ render_process_host->OnAudioStreamAdded();
monitor->OnStreamAdded();
if (!power_level_monitoring_available())
@@ -106,6 +112,12 @@ void AudioStreamMonitor::StopMonitoringHelper(int render_process_id,
if (!monitor)
return;
+ RenderProcessHostImpl* render_process_host =
+ static_cast<RenderProcessHostImpl*>(
+ RenderProcessHost::FromID(render_process_id));
+ if (!render_process_host)
+ return;
+ render_process_host->OnAudioStreamRemoved();
ncarter (slow) 2017/01/31 18:33:12 How confident are you that this perfectly balances
DaleCurtis 2017/02/06 22:19:02 Test added; it was incorrect before, but is correc
monitor->OnStreamRemoved();
if (!power_level_monitoring_available())

Powered by Google App Engine
This is Rietveld 408576698