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

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

Issue 2496173003: Communicate audio state to renderer process on Android. (Closed)
Patch Set: Created 4 years, 1 month 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/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(
« 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