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

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

Issue 2160963002: Add watch time metrics for HTML5 media playback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « media/base/media_log.h ('k') | media/base/media_log_event.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 const char MediaLog::kWatchTimeAudioVideoAll[] =
20 "Media.WatchTime.AudioVideo.All";
21 const char MediaLog::kWatchTimeAudioVideoMse[] =
22 "Media.WatchTime.AudioVideo.MSE";
23 const char MediaLog::kWatchTimeAudioVideoEme[] =
24 "Media.WatchTime.AudioVideo.EME";
25 const char MediaLog::kWatchTimeAudioVideoSrc[] =
26 "Media.WatchTime.AudioVideo.SRC";
27 const char MediaLog::kWatchTimeAudioVideoBattery[] =
28 "Media.WatchTime.AudioVideo.Battery";
29 const char MediaLog::kWatchTimeAudioVideoAc[] = "Media.WatchTime.AudioVideo.AC";
30
31 const char MediaLog::kWatchTimeFinalize[] = "FinalizeWatchTime";
32 const char MediaLog::kWatchTimeFinalizePower[] = "FinalizePowerWatchTime";
33
19 std::string MediaLog::MediaLogLevelToString(MediaLogLevel level) { 34 std::string MediaLog::MediaLogLevelToString(MediaLogLevel level) {
20 switch (level) { 35 switch (level) {
21 case MEDIALOG_ERROR: 36 case MEDIALOG_ERROR:
22 return "error"; 37 return "error";
23 case MEDIALOG_INFO: 38 case MEDIALOG_INFO:
24 return "info"; 39 return "info";
25 case MEDIALOG_DEBUG: 40 case MEDIALOG_DEBUG:
26 return "debug"; 41 return "debug";
27 } 42 }
28 NOTREACHED(); 43 NOTREACHED();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 case MediaLogEvent::BUFFERED_EXTENTS_CHANGED: 90 case MediaLogEvent::BUFFERED_EXTENTS_CHANGED:
76 return "BUFFERED_EXTENTS_CHANGED"; 91 return "BUFFERED_EXTENTS_CHANGED";
77 case MediaLogEvent::MEDIA_ERROR_LOG_ENTRY: 92 case MediaLogEvent::MEDIA_ERROR_LOG_ENTRY:
78 return "MEDIA_ERROR_LOG_ENTRY"; 93 return "MEDIA_ERROR_LOG_ENTRY";
79 case MediaLogEvent::MEDIA_INFO_LOG_ENTRY: 94 case MediaLogEvent::MEDIA_INFO_LOG_ENTRY:
80 return "MEDIA_INFO_LOG_ENTRY"; 95 return "MEDIA_INFO_LOG_ENTRY";
81 case MediaLogEvent::MEDIA_DEBUG_LOG_ENTRY: 96 case MediaLogEvent::MEDIA_DEBUG_LOG_ENTRY:
82 return "MEDIA_DEBUG_LOG_ENTRY"; 97 return "MEDIA_DEBUG_LOG_ENTRY";
83 case MediaLogEvent::PROPERTY_CHANGE: 98 case MediaLogEvent::PROPERTY_CHANGE:
84 return "PROPERTY_CHANGE"; 99 return "PROPERTY_CHANGE";
100 case MediaLogEvent::WATCH_TIME_UPDATE:
101 return "WATCH_TIME_UPDATE";
85 } 102 }
86 NOTREACHED(); 103 NOTREACHED();
87 return NULL; 104 return NULL;
88 } 105 }
89 106
90 std::string MediaLog::PipelineStatusToString(PipelineStatus status) { 107 std::string MediaLog::PipelineStatusToString(PipelineStatus status) {
91 switch (status) { 108 switch (status) {
92 case PIPELINE_OK: 109 case PIPELINE_OK:
93 return "pipeline: ok"; 110 return "pipeline: ok";
94 case PIPELINE_ERROR_NETWORK: 111 case PIPELINE_ERROR_NETWORK:
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 const scoped_refptr<MediaLog>& media_log) 304 const scoped_refptr<MediaLog>& media_log)
288 : level_(level), media_log_(media_log) { 305 : level_(level), media_log_(media_log) {
289 DCHECK(media_log_.get()); 306 DCHECK(media_log_.get());
290 } 307 }
291 308
292 LogHelper::~LogHelper() { 309 LogHelper::~LogHelper() {
293 media_log_->AddLogEvent(level_, stream_.str()); 310 media_log_->AddLogEvent(level_, stream_.str());
294 } 311 }
295 312
296 } //namespace media 313 } //namespace media
OLDNEW
« no previous file with comments | « media/base/media_log.h ('k') | media/base/media_log_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698