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

Unified Diff: chrome/browser/media/audio_stream_indicator.h

Issue 14600025: Replace AudioSilenceDetector with an AudioPowerMonitor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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: 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_
« no previous file with comments | « no previous file | chrome/browser/media/audio_stream_indicator.cc » ('j') | chrome/browser/media/audio_stream_indicator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698