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::SetProperty( | |
scherkus (not reviewing)
2013/08/02 21:53:48
these should be SetString/Integer/Double/Boolean a
Ty Overby
2013/08/02 23:04:27
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::SetProperty( | |
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::SetProperty( | |
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::SetProperty( | |
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 | |
211 void MediaLog::SetProperty( | |
212 const char* key, Value* value) { | |
scherkus (not reviewing)
2013/08/02 21:53:48
FYI you're not calling this method -- remove?
Ty Overby
2013/08/02 23:04:27
Done.
| |
213 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | |
214 event->params.Set(key, value); | |
215 AddEvent(event.Pass()); | |
216 } | |
217 | |
181 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( | 218 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( |
182 int64 start, int64 current, int64 end) { | 219 int64 start, int64 current, int64 end) { |
183 scoped_ptr<MediaLogEvent> event( | 220 scoped_ptr<MediaLogEvent> event( |
184 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); | 221 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); |
185 // These values are headed to JS where there is no int64 so we use a double | 222 // 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). | 223 // and accept loss of precision above 2^53 bytes (8 Exabytes). |
187 event->params.SetDouble("buffer_start", start); | 224 event->params.SetDouble("buffer_start", start); |
188 event->params.SetDouble("buffer_current", current); | 225 event->params.SetDouble("buffer_current", current); |
189 event->params.SetDouble("buffer_end", end); | 226 event->params.SetDouble("buffer_end", end); |
190 return event.Pass(); | 227 return event.Pass(); |
191 } | 228 } |
192 | 229 |
193 scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent( | 230 scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent( |
194 const std::string& error) { | 231 const std::string& error) { |
195 scoped_ptr<MediaLogEvent> event( | 232 scoped_ptr<MediaLogEvent> event( |
196 CreateEvent(MediaLogEvent::MEDIA_SOURCE_ERROR)); | 233 CreateEvent(MediaLogEvent::MEDIA_SOURCE_ERROR)); |
197 event->params.SetString("error", error); | 234 event->params.SetString("error", error); |
198 return event.Pass(); | 235 return event.Pass(); |
199 } | 236 } |
200 | 237 |
201 } //namespace media | 238 } //namespace media |
OLD | NEW |