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

Side by Side Diff: media/base/media_log.cc

Issue 2517313002: Merge M56: "Add audio only watch time metrics." (Closed)
Patch Set: Created 4 years 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.h ('k') | media/blink/watch_time_reporter.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "media/base/media_log.h" 5 #include "media/base/media_log.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 // A count of all MediaLogs created in the current process. Used to generate 15 // A count of all MediaLogs created in the current process. Used to generate
16 // unique IDs. 16 // unique IDs.
17 static base::StaticAtomicSequenceNumber g_media_log_count; 17 static base::StaticAtomicSequenceNumber g_media_log_count;
18 18
19 // Audio+video watch time metrics.
19 const char MediaLog::kWatchTimeAudioVideoAll[] = 20 const char MediaLog::kWatchTimeAudioVideoAll[] =
20 "Media.WatchTime.AudioVideo.All"; 21 "Media.WatchTime.AudioVideo.All";
21 const char MediaLog::kWatchTimeAudioVideoMse[] = 22 const char MediaLog::kWatchTimeAudioVideoMse[] =
22 "Media.WatchTime.AudioVideo.MSE"; 23 "Media.WatchTime.AudioVideo.MSE";
23 const char MediaLog::kWatchTimeAudioVideoEme[] = 24 const char MediaLog::kWatchTimeAudioVideoEme[] =
24 "Media.WatchTime.AudioVideo.EME"; 25 "Media.WatchTime.AudioVideo.EME";
25 const char MediaLog::kWatchTimeAudioVideoSrc[] = 26 const char MediaLog::kWatchTimeAudioVideoSrc[] =
26 "Media.WatchTime.AudioVideo.SRC"; 27 "Media.WatchTime.AudioVideo.SRC";
27 const char MediaLog::kWatchTimeAudioVideoBattery[] = 28 const char MediaLog::kWatchTimeAudioVideoBattery[] =
28 "Media.WatchTime.AudioVideo.Battery"; 29 "Media.WatchTime.AudioVideo.Battery";
29 const char MediaLog::kWatchTimeAudioVideoAc[] = "Media.WatchTime.AudioVideo.AC"; 30 const char MediaLog::kWatchTimeAudioVideoAc[] = "Media.WatchTime.AudioVideo.AC";
30 31
32 // Audio only "watch time" metrics.
33 const char MediaLog::kWatchTimeAudioAll[] = "Media.WatchTime.Audio.All";
34 const char MediaLog::kWatchTimeAudioMse[] = "Media.WatchTime.Audio.MSE";
35 const char MediaLog::kWatchTimeAudioEme[] = "Media.WatchTime.Audio.EME";
36 const char MediaLog::kWatchTimeAudioSrc[] = "Media.WatchTime.Audio.SRC";
37 const char MediaLog::kWatchTimeAudioBattery[] = "Media.WatchTime.Audio.Battery";
38 const char MediaLog::kWatchTimeAudioAc[] = "Media.WatchTime.Audio.AC";
39
31 const char MediaLog::kWatchTimeFinalize[] = "FinalizeWatchTime"; 40 const char MediaLog::kWatchTimeFinalize[] = "FinalizeWatchTime";
32 const char MediaLog::kWatchTimeFinalizePower[] = "FinalizePowerWatchTime"; 41 const char MediaLog::kWatchTimeFinalizePower[] = "FinalizePowerWatchTime";
33 42
34 std::string MediaLog::MediaLogLevelToString(MediaLogLevel level) { 43 std::string MediaLog::MediaLogLevelToString(MediaLogLevel level) {
35 switch (level) { 44 switch (level) {
36 case MEDIALOG_ERROR: 45 case MEDIALOG_ERROR:
37 return "error"; 46 return "error";
38 case MEDIALOG_INFO: 47 case MEDIALOG_INFO:
39 return "info"; 48 return "info";
40 case MEDIALOG_DEBUG: 49 case MEDIALOG_DEBUG:
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 const scoped_refptr<MediaLog>& media_log) 311 const scoped_refptr<MediaLog>& media_log)
303 : level_(level), media_log_(media_log) { 312 : level_(level), media_log_(media_log) {
304 DCHECK(media_log_.get()); 313 DCHECK(media_log_.get());
305 } 314 }
306 315
307 LogHelper::~LogHelper() { 316 LogHelper::~LogHelper() {
308 media_log_->AddLogEvent(level_, stream_.str()); 317 media_log_->AddLogEvent(level_, stream_.str());
309 } 318 }
310 319
311 } //namespace media 320 } //namespace media
OLDNEW
« no previous file with comments | « media/base/media_log.h ('k') | media/blink/watch_time_reporter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698