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

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

Issue 2948613002: [AudioStreamMonitor] Adds API to collect frame-level audibility. (Closed)
Patch Set: Removed public API, fixed tests 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
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..bed4d362d0d376d34a23910232a3bdf551e6eef1 100644
--- a/content/browser/media/audio_stream_monitor.h
+++ b/content/browser/media/audio_stream_monitor.h
@@ -14,6 +14,7 @@
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
+#include "base/tuple.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
#include "media/audio/audio_output_controller.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,7 +150,8 @@ 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>;
+ // StreamID is formed by <render_process_id, render_frame_id, stream_id>
+ using StreamID = std::tuple<int, int, int>;
DaleCurtis 2017/06/22 00:35:55 This would be clearer as: struct StreamID { int
lpy 2017/06/22 02:28:52 Done.
using StreamPollCallbackMap = std::map<StreamID, ReadPowerAndClipCallback>;
StreamPollCallbackMap poll_callbacks_;

Powered by Google App Engine
This is Rietveld 408576698