Index: chrome/browser/media/audio_stream_indicator.h |
diff --git a/chrome/browser/media/audio_stream_indicator.h b/chrome/browser/media/audio_stream_indicator.h |
index 2ce504e4cf67942859f1a1b6e08f7604a2516c6a..633a25b686c8ebea671e2f33ce751a3a4d8f10ce 100644 |
--- a/chrome/browser/media/audio_stream_indicator.h |
+++ b/chrome/browser/media/audio_stream_indicator.h |
@@ -6,7 +6,6 @@ |
#define CHROME_BROWSER_MEDIA_AUDIO_STREAM_INDICATOR_H_ |
#include <map> |
-#include <set> |
#include "base/memory/ref_counted.h" |
@@ -23,17 +22,19 @@ class AudioStreamIndicator |
void UpdateWebContentsStatus(int render_process_id, |
int render_view_id, |
int stream_id, |
- bool is_playing_and_audible); |
+ bool is_playing, |
+ float power_in_dbfs); |
- // This method should be called on the UI thread. |
- bool IsPlayingAudio(content::WebContents* contents); |
+ // These methods should be called on the UI thread. |
+ bool IsPlayingAudio(content::WebContents* contents) const; |
+ float GetAudioPowerLevelInDBFS(content::WebContents* contents) const; |
private: |
struct RenderViewId { |
RenderViewId(int render_process_id, |
int render_view_id); |
- // Required to use this struct in the std::multiset below. |
+ // Required to use this struct in the std::map below. |
bool operator<(const RenderViewId& other) const; |
int render_process_id; |
@@ -46,11 +47,15 @@ class AudioStreamIndicator |
void UpdateWebContentsStatusOnUIThread(int render_process_id, |
int render_view_id, |
int stream_id, |
- bool playing); |
- |
- // A map from RenderViews to sets of streams playing in them (each RenderView |
- // might have more than one stream). |
- std::map<RenderViewId, std::set<int> > audio_streams_; |
+ bool is_playing, |
+ float power_in_dbfs); |
+ |
+ // A map from RenderViews to the streams playing in them (each RenderView |
+ // might have more than one stream). An inner map associates each stream with |
+ // its last-known power level. |
+ typedef std::map<int, float> StreamPowerLevelMap; |
+ typedef std::map<RenderViewId, StreamPowerLevelMap> RenderViewStreamMap; |
+ RenderViewStreamMap audio_streams_; |
}; |
#endif // CHROME_BROWSER_MEDIA_AUDIO_STREAM_INDICATOR_H_ |