OLD | NEW |
---|---|
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 Loading... | |
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, | |
DaleCurtis
2014/11/11 20:48:58
Instead of having this wacky string conversion, ha
prabhur1
2014/11/12 21:32:37
Done.
| |
102 PipelineStatus& out_status) { | |
103 static const char* player_status[] = { | |
DaleCurtis
2014/11/11 20:48:58
Move this and compile_assert outside of the functi
prabhur1
2014/11/12 21:32:37
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 "", // == undefined | |
112 "pipeline: could not render", // == PIPELINE_ERROR_COULD_NOT_RENDER | |
113 "pipeline: read error", // == PIPELINE_ERROR_READ | |
114 "pipeline: operation pending", // == PIPELINE_ERROR_OPERATION_PENDING | |
115 "pipeline: invalid state", // == PIPELINE_ERROR_INVALID_STATE | |
116 "demuxer: could not open", // == DEMUXER_ERROR_COULD_NOT_OPEN | |
117 "dumuxer: could not parse", // == DEMUXER_ERROR_COULD_NOT_PARSE | |
DaleCurtis
2014/11/11 20:48:58
demuxer instead of dumuxer :)
prabhur1
2014/11/12 21:32:37
Done.
| |
118 "demuxer: no supported streams", // == DEMUXER_ERROR_NO_SUPPORTED_STREAMS | |
119 "decoder: not supported" // == DECODER_ERROR_NOT_SUPPORTED | |
120 }; | |
121 COMPILE_ASSERT(arraysize(player_status) == PIPELINE_STATUS_MAX + 1, | |
122 "player_status out of sync with PipelineStatus"); | |
123 for (uint32 i = 0; i < arraysize(player_status); i++) { | |
DaleCurtis
2014/11/11 20:48:58
size_t
prabhur1
2014/11/12 21:32:37
Done.
| |
124 if (player_status[i] == status) { | |
125 out_status = (PipelineStatus)i; | |
DaleCurtis
2014/11/11 20:48:58
static_cast<PipelineStatus>(i)
prabhur1
2014/11/12 21:32:37
Done.
| |
126 return true; | |
127 } | |
128 } | |
129 return false; | |
130 } | |
131 | |
101 LogHelper::LogHelper(const LogCB& log_cb) : log_cb_(log_cb) {} | 132 LogHelper::LogHelper(const LogCB& log_cb) : log_cb_(log_cb) {} |
102 | 133 |
103 LogHelper::~LogHelper() { | 134 LogHelper::~LogHelper() { |
104 if (log_cb_.is_null()) | 135 if (log_cb_.is_null()) |
105 return; | 136 return; |
106 log_cb_.Run(stream_.str()); | 137 log_cb_.Run(stream_.str()); |
107 } | 138 } |
108 | 139 |
109 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {} | 140 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {} |
110 | 141 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 const char* key, base::TimeDelta value) { | 262 const char* key, base::TimeDelta value) { |
232 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | 263 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); |
233 if (value.is_max()) | 264 if (value.is_max()) |
234 event->params.SetString(key, "unknown"); | 265 event->params.SetString(key, "unknown"); |
235 else | 266 else |
236 event->params.SetDouble(key, value.InSecondsF()); | 267 event->params.SetDouble(key, value.InSecondsF()); |
237 AddEvent(event.Pass()); | 268 AddEvent(event.Pass()); |
238 } | 269 } |
239 | 270 |
240 } //namespace media | 271 } //namespace media |
OLD | NEW |