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

Side by Side Diff: media/blink/watch_time_reporter.h

Issue 2517313002: Merge M56: "Add audio only watch time metrics." (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « media/base/media_log.cc ('k') | media/blink/watch_time_reporter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BLINK_WATCH_TIME_REPORTER_H_ 5 #ifndef MEDIA_BLINK_WATCH_TIME_REPORTER_H_
6 #define MEDIA_BLINK_WATCH_TIME_REPORTER_H_ 6 #define MEDIA_BLINK_WATCH_TIME_REPORTER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/power_monitor/power_observer.h" 9 #include "base/power_monitor/power_observer.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
12 #include "media/base/media_log.h" 12 #include "media/base/media_log.h"
13 #include "media/base/timestamp_constants.h" 13 #include "media/base/timestamp_constants.h"
14 #include "media/blink/media_blink_export.h" 14 #include "media/blink/media_blink_export.h"
15 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 // Class for monitoring and reporting watch time in response to various state 19 // Class for monitoring and reporting watch time in response to various state
20 // changes during the playback of media. At present we are only recording the 20 // changes during the playback of media. We record metrics for audio only
21 // watch time for audio+video playbacks. 21 // playbacks as well as audio+video playbacks of sufficient size.
22 // TODO(dalecurtis): We want to introduce a similar "listening time" metric in
23 // the near future to track audio only cases.
24 // 22 //
25 // Watch time for our purposes is defined as the amount of elapsed media time 23 // Watch time for our purposes is defined as the amount of elapsed media time
26 // for audio+video media. A minimum of 7 seconds of unmuted, foreground media 24 // for audio only or audio+video media. A minimum of 7 seconds of unmuted,
27 // must be watched to start watch time monitoring. Watch time is checked every 25 // foreground (where this is video) media must be watched to start watch time
28 // 5 seconds from then on and reported to multiple buckets: All, MSE, SRC, EME, 26 // monitoring. Watch time is checked every 5 seconds from then on and reported
29 // AC, and battery. 27 // to multiple buckets: All, MSE, SRC, EME, AC, and battery.
30 // 28 //
31 // Any one of paused, hidden, or muted is sufficient to stop watch time metric 29 // Any one of paused, hidden (where this is video), or muted is sufficient to
32 // reports. Each of these has a hysteresis where if the state change is undone 30 // stop watch time metric reports. Each of these has a hysteresis where if the
33 // within 5 seconds, the watch time will be counted as uninterrupted. 31 // state change is undone within 5 seconds, the watch time will be counted as
32 // uninterrupted.
34 // 33 //
35 // Power events (on/off battery power) have a similar hysteresis, but unlike 34 // Power events (on/off battery power) have a similar hysteresis, but unlike
36 // the aforementioned properties, will not stop metric collection. 35 // the aforementioned properties, will not stop metric collection.
37 // 36 //
38 // Each seek event will result in a new watch time metric being started and the 37 // Each seek event will result in a new watch time metric being started and the
39 // old metric finalized as accurately as possible. 38 // old metric finalized as accurately as possible.
40 class MEDIA_BLINK_EXPORT WatchTimeReporter : base::PowerObserver { 39 class MEDIA_BLINK_EXPORT WatchTimeReporter : base::PowerObserver {
41 public: 40 public:
42 using GetMediaTimeCB = base::Callback<base::TimeDelta(void)>; 41 using GetMediaTimeCB = base::Callback<base::TimeDelta(void)>;
43 42
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // battery or AC power is being used. 144 // battery or AC power is being used.
146 base::TimeDelta start_timestamp_for_power_; 145 base::TimeDelta start_timestamp_for_power_;
147 base::TimeDelta end_timestamp_for_power_ = kNoTimestamp; 146 base::TimeDelta end_timestamp_for_power_ = kNoTimestamp;
148 147
149 DISALLOW_COPY_AND_ASSIGN(WatchTimeReporter); 148 DISALLOW_COPY_AND_ASSIGN(WatchTimeReporter);
150 }; 149 };
151 150
152 } // namespace media 151 } // namespace media
153 152
154 #endif // MEDIA_BLINK_WATCH_TIME_REPORTER_H_ 153 #endif // MEDIA_BLINK_WATCH_TIME_REPORTER_H_
OLDNEW
« no previous file with comments | « media/base/media_log.cc ('k') | media/blink/watch_time_reporter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698