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

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

Issue 697463005: Add PipelineStatus UMA logging to media_internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 <string> 7 #include <string>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return "dumuxer: could not parse"; 91 return "dumuxer: could not parse";
92 case DEMUXER_ERROR_NO_SUPPORTED_STREAMS: 92 case DEMUXER_ERROR_NO_SUPPORTED_STREAMS:
93 return "demuxer: no supported streams"; 93 return "demuxer: no supported streams";
94 case DECODER_ERROR_NOT_SUPPORTED: 94 case DECODER_ERROR_NOT_SUPPORTED:
95 return "decoder: not supported"; 95 return "decoder: not supported";
96 } 96 }
97 NOTREACHED(); 97 NOTREACHED();
98 return NULL; 98 return NULL;
99 } 99 }
100 100
101 bool MediaLog::StringToPipelineStatus(const std::string& status,
102 PipelineStatus& out_status) {
103 static std::map<std::string, PipelineStatus> status_map = {
DaleCurtis 2014/11/06 23:49:08 Instead just create a parallel array of strings wh
prabhur1 2014/11/07 23:43:24 Done.
104 {"pipeline: ok", PIPELINE_OK},
105 {"pipeline: url not found", PIPELINE_ERROR_URL_NOT_FOUND},
106 {"pipeline: network error", PIPELINE_ERROR_NETWORK},
107 {"pipeline: decode error", PIPELINE_ERROR_DECODE},
108 {"pipeline: decrypt error", PIPELINE_ERROR_DECRYPT},
109 {"pipeline: abort", PIPELINE_ERROR_ABORT},
110 {"pipeline: initialization failed", PIPELINE_ERROR_INITIALIZATION_FAILED},
111 {"pipeline: could not render", PIPELINE_ERROR_COULD_NOT_RENDER},
112 {"pipeline: read error", PIPELINE_ERROR_READ},
113 {"pipeline: operation pending", PIPELINE_ERROR_OPERATION_PENDING},
114 {"pipeline: invalid state", PIPELINE_ERROR_INVALID_STATE},
115 {"demuxer: could not open", DEMUXER_ERROR_COULD_NOT_OPEN},
116 {"dumuxer: could not parse", DEMUXER_ERROR_COULD_NOT_PARSE},
117 {"demuxer: no supported streams", DEMUXER_ERROR_NO_SUPPORTED_STREAMS},
118 {"decoder: not supported", DECODER_ERROR_NOT_SUPPORTED}};
119 auto it = status_map.find(status);
120 if (it != status_map.end()) {
121 out_status = status_map[status];
122 return true;
123 }
124 return false;
125 }
126
101 LogHelper::LogHelper(const LogCB& log_cb) : log_cb_(log_cb) {} 127 LogHelper::LogHelper(const LogCB& log_cb) : log_cb_(log_cb) {}
102 128
103 LogHelper::~LogHelper() { 129 LogHelper::~LogHelper() {
104 if (log_cb_.is_null()) 130 if (log_cb_.is_null())
105 return; 131 return;
106 log_cb_.Run(stream_.str()); 132 log_cb_.Run(stream_.str());
107 } 133 }
108 134
109 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {} 135 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {}
110 136
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 const char* key, base::TimeDelta value) { 257 const char* key, base::TimeDelta value) {
232 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); 258 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE));
233 if (value.is_max()) 259 if (value.is_max())
234 event->params.SetString(key, "unknown"); 260 event->params.SetString(key, "unknown");
235 else 261 else
236 event->params.SetDouble(key, value.InSecondsF()); 262 event->params.SetDouble(key, value.InSecondsF());
237 AddEvent(event.Pass()); 263 AddEvent(event.Pass());
238 } 264 }
239 265
240 } //namespace media 266 } //namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698