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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 case MediaLogEvent::ENDED: | 49 case MediaLogEvent::ENDED: |
50 return "ENDED"; | 50 return "ENDED"; |
51 case MediaLogEvent::TEXT_ENDED: | 51 case MediaLogEvent::TEXT_ENDED: |
52 return "TEXT_ENDED"; | 52 return "TEXT_ENDED"; |
53 case MediaLogEvent::BUFFERED_EXTENTS_CHANGED: | 53 case MediaLogEvent::BUFFERED_EXTENTS_CHANGED: |
54 return "BUFFERED_EXTENTS_CHANGED"; | 54 return "BUFFERED_EXTENTS_CHANGED"; |
55 case MediaLogEvent::MEDIA_SOURCE_ERROR: | 55 case MediaLogEvent::MEDIA_SOURCE_ERROR: |
56 return "MEDIA_SOURCE_ERROR"; | 56 return "MEDIA_SOURCE_ERROR"; |
57 case MediaLogEvent::PROPERTY_CHANGE: | 57 case MediaLogEvent::PROPERTY_CHANGE: |
58 return "PROPERTY_CHANGE"; | 58 return "PROPERTY_CHANGE"; |
59 case MediaLogEvent::INFO: | |
60 return "INFO"; | |
59 } | 61 } |
60 NOTREACHED(); | 62 NOTREACHED(); |
61 return NULL; | 63 return NULL; |
62 } | 64 } |
63 | 65 |
64 const char* MediaLog::PipelineStatusToString(PipelineStatus status) { | 66 const char* MediaLog::PipelineStatusToString(PipelineStatus status) { |
65 switch (status) { | 67 switch (status) { |
66 case PIPELINE_OK: | 68 case PIPELINE_OK: |
67 return "pipeline: ok"; | 69 return "pipeline: ok"; |
68 case PIPELINE_ERROR_URL_NOT_FOUND: | 70 case PIPELINE_ERROR_URL_NOT_FOUND: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 } | 194 } |
193 | 195 |
194 scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent( | 196 scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent( |
195 const std::string& error) { | 197 const std::string& error) { |
196 scoped_ptr<MediaLogEvent> event( | 198 scoped_ptr<MediaLogEvent> event( |
197 CreateEvent(MediaLogEvent::MEDIA_SOURCE_ERROR)); | 199 CreateEvent(MediaLogEvent::MEDIA_SOURCE_ERROR)); |
198 event->params.SetString("error", error); | 200 event->params.SetString("error", error); |
199 return event.Pass(); | 201 return event.Pass(); |
200 } | 202 } |
201 | 203 |
204 scoped_ptr<MediaLogEvent> MediaLog::CreateInfoEvent(const std::string& info) { | |
205 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::INFO)); | |
206 event->params.SetString("INFO", info); | |
xhwang
2014/09/08 17:31:21
Note we have "error" above. Not sure whether we sh
| |
207 return event.Pass(); | |
208 } | |
209 | |
202 void MediaLog::SetStringProperty( | 210 void MediaLog::SetStringProperty( |
203 const char* key, const std::string& value) { | 211 const char* key, const std::string& value) { |
204 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | 212 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); |
205 event->params.SetString(key, value); | 213 event->params.SetString(key, value); |
206 AddEvent(event.Pass()); | 214 AddEvent(event.Pass()); |
207 } | 215 } |
208 | 216 |
209 void MediaLog::SetIntegerProperty( | 217 void MediaLog::SetIntegerProperty( |
210 const char* key, int value) { | 218 const char* key, int value) { |
211 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | 219 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); |
(...skipping 19 matching lines...) Expand all Loading... | |
231 const char* key, base::TimeDelta value) { | 239 const char* key, base::TimeDelta value) { |
232 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | 240 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); |
233 if (value.is_max()) | 241 if (value.is_max()) |
234 event->params.SetString(key, "unknown"); | 242 event->params.SetString(key, "unknown"); |
235 else | 243 else |
236 event->params.SetDouble(key, value.InSecondsF()); | 244 event->params.SetDouble(key, value.InSecondsF()); |
237 AddEvent(event.Pass()); | 245 AddEvent(event.Pass()); |
238 } | 246 } |
239 | 247 |
240 } //namespace media | 248 } //namespace media |
OLD | NEW |