Chromium Code Reviews| 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::AUDIO_ENDED: | 49 case MediaLogEvent::AUDIO_ENDED: |
| 50 return "AUDIO_ENDED"; | 50 return "AUDIO_ENDED"; |
| 51 case MediaLogEvent::VIDEO_ENDED: | 51 case MediaLogEvent::VIDEO_ENDED: |
| 52 return "VIDEO_ENDED"; | 52 return "VIDEO_ENDED"; |
| 53 case MediaLogEvent::AUDIO_RENDERER_DISABLED: | 53 case MediaLogEvent::AUDIO_RENDERER_DISABLED: |
| 54 return "AUDIO_RENDERER_DISABLED"; | 54 return "AUDIO_RENDERER_DISABLED"; |
| 55 case MediaLogEvent::BUFFERED_EXTENTS_CHANGED: | 55 case MediaLogEvent::BUFFERED_EXTENTS_CHANGED: |
| 56 return "BUFFERED_EXTENTS_CHANGED"; | 56 return "BUFFERED_EXTENTS_CHANGED"; |
| 57 case MediaLogEvent::MEDIA_SOURCE_ERROR: | 57 case MediaLogEvent::MEDIA_SOURCE_ERROR: |
| 58 return "MEDIA_SOURCE_ERROR"; | 58 return "MEDIA_SOURCE_ERROR"; |
| 59 case MediaLogEvent::PROPERTY_CHANGE: | |
| 60 return "PROPERTY_CHANGE"; | |
| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 } | 173 } |
| 172 | 174 |
| 173 scoped_ptr<MediaLogEvent> MediaLog::CreateVideoSizeSetEvent( | 175 scoped_ptr<MediaLogEvent> MediaLog::CreateVideoSizeSetEvent( |
| 174 size_t width, size_t height) { | 176 size_t width, size_t height) { |
| 175 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::VIDEO_SIZE_SET)); | 177 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::VIDEO_SIZE_SET)); |
| 176 event->params.SetInteger("width", width); | 178 event->params.SetInteger("width", width); |
| 177 event->params.SetInteger("height", height); | 179 event->params.SetInteger("height", height); |
| 178 return event.Pass(); | 180 return event.Pass(); |
| 179 } | 181 } |
| 180 | 182 |
| 183 void MediaLog::SetStringProperty( | |
|
scherkus (not reviewing)
2013/08/02 23:18:19
try to match the .h order of methods when possible
Ty Overby
2013/08/03 00:02:23
Done.
| |
| 184 const char* key, const std::string& value) { | |
| 185 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | |
| 186 event->params.SetString(key, value); | |
| 187 AddEvent(event.Pass()); | |
| 188 } | |
| 189 | |
| 190 void MediaLog::SetIntegerProperty( | |
| 191 const char* key, int value) { | |
| 192 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | |
| 193 event->params.SetInteger(key, value); | |
| 194 AddEvent(event.Pass()); | |
| 195 } | |
| 196 | |
| 197 void MediaLog::SetDoubleProperty( | |
| 198 const char* key, double value) { | |
| 199 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | |
| 200 event->params.SetDouble(key, value); | |
| 201 AddEvent(event.Pass()); | |
| 202 } | |
| 203 | |
| 204 void MediaLog::SetBooleanProperty( | |
| 205 const char* key, bool value) { | |
| 206 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | |
| 207 event->params.SetBoolean(key, value); | |
| 208 AddEvent(event.Pass()); | |
| 209 } | |
| 210 | |
| 181 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( | 211 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( |
| 182 int64 start, int64 current, int64 end) { | 212 int64 start, int64 current, int64 end) { |
| 183 scoped_ptr<MediaLogEvent> event( | 213 scoped_ptr<MediaLogEvent> event( |
| 184 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); | 214 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); |
| 185 // These values are headed to JS where there is no int64 so we use a double | 215 // These values are headed to JS where there is no int64 so we use a double |
| 186 // and accept loss of precision above 2^53 bytes (8 Exabytes). | 216 // and accept loss of precision above 2^53 bytes (8 Exabytes). |
| 187 event->params.SetDouble("buffer_start", start); | 217 event->params.SetDouble("buffer_start", start); |
| 188 event->params.SetDouble("buffer_current", current); | 218 event->params.SetDouble("buffer_current", current); |
| 189 event->params.SetDouble("buffer_end", end); | 219 event->params.SetDouble("buffer_end", end); |
| 190 return event.Pass(); | 220 return event.Pass(); |
| 191 } | 221 } |
| 192 | 222 |
| 193 scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent( | 223 scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent( |
| 194 const std::string& error) { | 224 const std::string& error) { |
| 195 scoped_ptr<MediaLogEvent> event( | 225 scoped_ptr<MediaLogEvent> event( |
| 196 CreateEvent(MediaLogEvent::MEDIA_SOURCE_ERROR)); | 226 CreateEvent(MediaLogEvent::MEDIA_SOURCE_ERROR)); |
| 197 event->params.SetString("error", error); | 227 event->params.SetString("error", error); |
| 198 return event.Pass(); | 228 return event.Pass(); |
| 199 } | 229 } |
| 200 | 230 |
| 201 } //namespace media | 231 } //namespace media |
| OLD | NEW |