Chromium Code Reviews| 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 36e11030eb105138d231d53c7af5a0280d4ce3e4..92ec7c25c873fad07e54e482430fae6f4686976d 100644 |
| --- a/content/browser/media/audio_stream_monitor.cc |
| +++ b/content/browser/media/audio_stream_monitor.cc |
| @@ -54,8 +54,6 @@ void AudioStreamMonitor::StartMonitoringStream( |
| int render_frame_id, |
| int stream_id, |
| const ReadPowerAndClipCallback& read_power_callback) { |
| - if (!monitoring_available()) |
|
DaleCurtis
2016/11/14 18:51:07
Can we change this to power_level_monitoring() or
altimin
2016/11/15 12:06:17
Done. There is some logic that uses this function
|
| - return; |
| BrowserThread::PostTask(BrowserThread::UI, |
| FROM_HERE, |
| base::Bind(&StartMonitoringHelper, |
| @@ -69,8 +67,6 @@ void AudioStreamMonitor::StartMonitoringStream( |
| void AudioStreamMonitor::StopMonitoringStream(int render_process_id, |
| int render_frame_id, |
| int stream_id) { |
| - if (!media::AudioOutputController::will_monitor_audio_levels()) |
| - return; |
| BrowserThread::PostTask(BrowserThread::UI, |
| FROM_HERE, |
| base::Bind(&StopMonitoringHelper, |
| @@ -89,6 +85,14 @@ void AudioStreamMonitor::StartMonitoringHelper( |
| AudioStreamMonitor* const monitor = |
| AudioStreamMonitorFromRenderFrame(render_process_id, render_frame_id); |
| if (monitor) { |
|
DaleCurtis
2016/11/14 18:51:07
Invert to if (!monitor) return to avoid extra nest
altimin
2016/11/15 12:06:17
Done.
|
| + if (!monitoring_available()) { |
| + // If audio level monitoring is not available, assume that an active |
|
DaleCurtis
2016/11/14 18:51:07
Reflow comment.
altimin
2016/11/15 12:06:17
Done.
|
| + // stream |
| + // means audio signal. |
| + monitor->web_contents_->OnAudioStateChanged(true); |
| + return; |
| + } |
| + |
| monitor->StartMonitoringStreamOnUIThread( |
| render_process_id, stream_id, read_power_callback); |
| } |
| @@ -101,8 +105,13 @@ void AudioStreamMonitor::StopMonitoringHelper(int render_process_id, |
| DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| AudioStreamMonitor* const monitor = |
| AudioStreamMonitorFromRenderFrame(render_process_id, render_frame_id); |
| - if (monitor) |
| + if (monitor) { |
|
DaleCurtis
2016/11/14 18:51:07
Invert to if (!monitor) return to avoid extra nest
altimin
2016/11/15 12:06:17
Done.
|
| + if (!monitoring_available()) { |
| + monitor->web_contents_->OnAudioStateChanged(false); |
| + return; |
| + } |
| monitor->StopMonitoringStreamOnUIThread(render_process_id, stream_id); |
| + } |
| } |
| void AudioStreamMonitor::StartMonitoringStreamOnUIThread( |