| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } | 57 } |
| 58 NOTREACHED(); | 58 NOTREACHED(); |
| 59 return NULL; | 59 return NULL; |
| 60 } | 60 } |
| 61 | 61 |
| 62 const char* MediaLog::PipelineStateToString(Pipeline::State state) { | |
| 63 switch (state) { | |
| 64 case Pipeline::kCreated: | |
| 65 return "created"; | |
| 66 case Pipeline::kInitDemuxer: | |
| 67 return "initDemuxer"; | |
| 68 case Pipeline::kInitAudioDecoder: | |
| 69 return "initAudioDecoder"; | |
| 70 case Pipeline::kInitAudioRenderer: | |
| 71 return "initAudioRenderer"; | |
| 72 case Pipeline::kInitVideoRenderer: | |
| 73 return "initVideoRenderer"; | |
| 74 case Pipeline::kPausing: | |
| 75 return "pausing"; | |
| 76 case Pipeline::kSeeking: | |
| 77 return "seeking"; | |
| 78 case Pipeline::kFlushing: | |
| 79 return "flushing"; | |
| 80 case Pipeline::kStarting: | |
| 81 return "starting"; | |
| 82 case Pipeline::kStarted: | |
| 83 return "started"; | |
| 84 case Pipeline::kStopping: | |
| 85 return "stopping"; | |
| 86 case Pipeline::kStopped: | |
| 87 return "stopped"; | |
| 88 } | |
| 89 NOTREACHED(); | |
| 90 return NULL; | |
| 91 } | |
| 92 | |
| 93 const char* MediaLog::PipelineStatusToString(PipelineStatus status) { | 62 const char* MediaLog::PipelineStatusToString(PipelineStatus status) { |
| 94 switch (status) { | 63 switch (status) { |
| 95 case PIPELINE_OK: | 64 case PIPELINE_OK: |
| 96 return "pipeline: ok"; | 65 return "pipeline: ok"; |
| 97 case PIPELINE_ERROR_URL_NOT_FOUND: | 66 case PIPELINE_ERROR_URL_NOT_FOUND: |
| 98 return "pipeline: url not found"; | 67 return "pipeline: url not found"; |
| 99 case PIPELINE_ERROR_NETWORK: | 68 case PIPELINE_ERROR_NETWORK: |
| 100 return "pipeline: network error"; | 69 return "pipeline: network error"; |
| 101 case PIPELINE_ERROR_DECODE: | 70 case PIPELINE_ERROR_DECODE: |
| 102 return "pipeline: decode error"; | 71 return "pipeline: decode error"; |
| 103 case PIPELINE_ERROR_DECRYPT: | 72 case PIPELINE_ERROR_DECRYPT: |
| 104 return "pipeline: decrypt error"; | 73 return "pipeline: decrypt error"; |
| 105 case PIPELINE_ERROR_ABORT: | 74 case PIPELINE_ERROR_ABORT: |
| 106 return "pipeline: abort"; | 75 return "pipeline: abort"; |
| 107 case PIPELINE_ERROR_INITIALIZATION_FAILED: | 76 case PIPELINE_ERROR_INITIALIZATION_FAILED: |
| 108 return "pipeline: initialization failed"; | 77 return "pipeline: initialization failed"; |
| 109 case PIPELINE_ERROR_REQUIRED_FILTER_MISSING: | |
| 110 return "pipeline: required filter missing"; | |
| 111 case PIPELINE_ERROR_COULD_NOT_RENDER: | 78 case PIPELINE_ERROR_COULD_NOT_RENDER: |
| 112 return "pipeline: could not render"; | 79 return "pipeline: could not render"; |
| 113 case PIPELINE_ERROR_READ: | 80 case PIPELINE_ERROR_READ: |
| 114 return "pipeline: read error"; | 81 return "pipeline: read error"; |
| 115 case PIPELINE_ERROR_OPERATION_PENDING: | 82 case PIPELINE_ERROR_OPERATION_PENDING: |
| 116 return "pipeline: operation pending"; | 83 return "pipeline: operation pending"; |
| 117 case PIPELINE_ERROR_INVALID_STATE: | 84 case PIPELINE_ERROR_INVALID_STATE: |
| 118 return "pipeline: invalid state"; | 85 return "pipeline: invalid state"; |
| 119 case DEMUXER_ERROR_COULD_NOT_OPEN: | 86 case DEMUXER_ERROR_COULD_NOT_OPEN: |
| 120 return "demuxer: could not open"; | 87 return "demuxer: could not open"; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 scoped_ptr<MediaLogEvent> MediaLog::CreateSeekEvent(float seconds) { | 142 scoped_ptr<MediaLogEvent> MediaLog::CreateSeekEvent(float seconds) { |
| 176 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::SEEK)); | 143 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::SEEK)); |
| 177 event->params.SetDouble("seek_target", seconds); | 144 event->params.SetDouble("seek_target", seconds); |
| 178 return event.Pass(); | 145 return event.Pass(); |
| 179 } | 146 } |
| 180 | 147 |
| 181 scoped_ptr<MediaLogEvent> MediaLog::CreatePipelineStateChangedEvent( | 148 scoped_ptr<MediaLogEvent> MediaLog::CreatePipelineStateChangedEvent( |
| 182 Pipeline::State state) { | 149 Pipeline::State state) { |
| 183 scoped_ptr<MediaLogEvent> event( | 150 scoped_ptr<MediaLogEvent> event( |
| 184 CreateEvent(MediaLogEvent::PIPELINE_STATE_CHANGED)); | 151 CreateEvent(MediaLogEvent::PIPELINE_STATE_CHANGED)); |
| 185 event->params.SetString("pipeline_state", PipelineStateToString(state)); | 152 event->params.SetString("pipeline_state", Pipeline::GetStateString(state)); |
| 186 return event.Pass(); | 153 return event.Pass(); |
| 187 } | 154 } |
| 188 | 155 |
| 189 scoped_ptr<MediaLogEvent> MediaLog::CreatePipelineErrorEvent( | 156 scoped_ptr<MediaLogEvent> MediaLog::CreatePipelineErrorEvent( |
| 190 PipelineStatus error) { | 157 PipelineStatus error) { |
| 191 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PIPELINE_ERROR)); | 158 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PIPELINE_ERROR)); |
| 192 event->params.SetString("pipeline_error", PipelineStatusToString(error)); | 159 event->params.SetString("pipeline_error", PipelineStatusToString(error)); |
| 193 return event.Pass(); | 160 return event.Pass(); |
| 194 } | 161 } |
| 195 | 162 |
| 196 scoped_ptr<MediaLogEvent> MediaLog::CreateVideoSizeSetEvent( | 163 scoped_ptr<MediaLogEvent> MediaLog::CreateVideoSizeSetEvent( |
| 197 size_t width, size_t height) { | 164 size_t width, size_t height) { |
| 198 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::VIDEO_SIZE_SET)); | 165 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::VIDEO_SIZE_SET)); |
| 199 event->params.SetInteger("width", width); | 166 event->params.SetInteger("width", width); |
| 200 event->params.SetInteger("height", height); | 167 event->params.SetInteger("height", height); |
| 201 return event.Pass(); | 168 return event.Pass(); |
| 202 } | 169 } |
| 203 | 170 |
| 204 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( | 171 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( |
| 205 size_t start, size_t current, size_t end) { | 172 size_t start, size_t current, size_t end) { |
| 206 scoped_ptr<MediaLogEvent> event( | 173 scoped_ptr<MediaLogEvent> event( |
| 207 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); | 174 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); |
| 208 event->params.SetInteger("buffer_start", start); | 175 event->params.SetInteger("buffer_start", start); |
| 209 event->params.SetInteger("buffer_current", current); | 176 event->params.SetInteger("buffer_current", current); |
| 210 event->params.SetInteger("buffer_end", end); | 177 event->params.SetInteger("buffer_end", end); |
| 211 return event.Pass(); | 178 return event.Pass(); |
| 212 } | 179 } |
| 213 | 180 |
| 214 } //namespace media | 181 } //namespace media |
| OLD | NEW |