Index: content/browser/media/audio_stream_monitor.h |
diff --git a/content/browser/media/audio_stream_monitor.h b/content/browser/media/audio_stream_monitor.h |
index 12f06055c54970fda0d454eae788c1a6346439aa..7a9d7657601c67404a79521b14c2193dadd214f4 100644 |
--- a/content/browser/media/audio_stream_monitor.h |
+++ b/content/browser/media/audio_stream_monitor.h |
@@ -34,15 +34,19 @@ class WebContents; |
// to turn on/off repeatedly and annoy the user. AudioStreamMonitor sends UI |
// update notifications only when needed, but may be queried at any time. |
// |
+// When power level monitoring is not available, audibility is approximated |
+// with having active audio streams. |
+// |
// Each WebContentsImpl owns an AudioStreamMonitor. |
class CONTENT_EXPORT AudioStreamMonitor { |
public: |
explicit AudioStreamMonitor(WebContents* contents); |
~AudioStreamMonitor(); |
- // Indicates if audio stream monitoring is available. It's only available if |
- // AudioOutputController can and will monitor output power levels. |
- static bool monitoring_available() { |
+ // Indicates if monitoring of audio stream power level is available. |
+ // It's only available if AudioOutputController can and will monitor |
+ // output power levels. |
+ static bool power_level_monitoring_available() { |
return media::AudioOutputController::will_monitor_audio_levels(); |
} |
@@ -119,6 +123,12 @@ class CONTENT_EXPORT AudioStreamMonitor { |
// on, |off_timer_| is started to re-invoke this method in the future. |
void MaybeToggle(); |
+ // Helper functions to track number of active streams when power level |
+ // monitoring |
+ // is not available. |
miu
2016/11/15 22:06:04
This can go on the above line.
altimin
2016/11/16 12:52:46
Done.
|
+ void OnStreamAdded(); |
+ void OnStreamRemoved(); |
+ |
// The WebContents instance to receive indicator toggle notifications. This |
// pointer should be valid for the lifetime of AudioStreamMonitor. |
WebContents* const web_contents_; |
@@ -154,6 +164,10 @@ class CONTENT_EXPORT AudioStreamMonitor { |
// future. |
base::OneShotTimer off_timer_; |
+ // Number of active streams to be used as a proxy for audibility when power |
+ // level monitoring is not available. |
+ size_t active_streams_; |
+ |
DISALLOW_COPY_AND_ASSIGN(AudioStreamMonitor); |
}; |