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

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

Issue 2948613002: [AudioStreamMonitor] Adds API to collect frame-level audibility. (Closed)
Patch Set: Fix windows build Created 3 years, 6 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
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/media/audio_stream_monitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f925c91ebe13af336480b91c1ad01c43faabb37f..7433ced7186a7a70b00daeb5b750a2975f9bb8ce 100644
--- a/content/browser/media/audio_stream_monitor.h
+++ b/content/browser/media/audio_stream_monitor.h
@@ -9,6 +9,7 @@
#include <utility>
#include "base/callback_forward.h"
+#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/threading/thread_checker.h"
#include "base/time/default_tick_clock.h"
@@ -111,12 +112,15 @@ class CONTENT_EXPORT AudioStreamMonitor {
// Starts polling the stream for audio stream power levels using |callback|.
void StartMonitoringStreamOnUIThread(
int render_process_id,
+ int render_frame_id,
int stream_id,
const ReadPowerAndClipCallback& callback);
// Stops polling the stream, discarding the internal copy of the |callback|
// provided in the call to StartMonitoringStream().
- void StopMonitoringStreamOnUIThread(int render_process_id, int stream_id);
+ void StopMonitoringStreamOnUIThread(int render_process_id,
+ int render_frame_id,
+ int stream_id);
// Called by |poll_timer_| to sample the power levels from each of the streams
// playing in the tab.
@@ -146,8 +150,15 @@ class CONTENT_EXPORT AudioStreamMonitor {
// The callbacks to read power levels for each stream. Only playing (i.e.,
// not paused) streams will have an entry in this map.
- using StreamID = std::pair<int, int>;
- using StreamPollCallbackMap = std::map<StreamID, ReadPowerAndClipCallback>;
+ struct CONTENT_EXPORT StreamID {
+ int render_process_id;
+ int render_frame_id;
+ int stream_id;
+ bool operator<(const StreamID& other) const;
+ bool operator==(const StreamID& other) const;
+ };
+ using StreamPollCallbackMap =
+ base::flat_map<StreamID, ReadPowerAndClipCallback>;
StreamPollCallbackMap poll_callbacks_;
// Records the last time at which sound was audible from any stream.
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/browser/media/audio_stream_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698