Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: media/base/media_log.cc

Issue 11471006: Log MediaSource parsing errors to the MediaLog so they can appear in chrome:media-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 case MediaLogEvent::NETWORK_ACTIVITY_SET: 47 case MediaLogEvent::NETWORK_ACTIVITY_SET:
48 return "NETWORK_ACTIVITY_SET"; 48 return "NETWORK_ACTIVITY_SET";
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:
58 return "MEDIA_SOURCE_ERROR";
57 } 59 }
58 NOTREACHED(); 60 NOTREACHED();
59 return NULL; 61 return NULL;
60 } 62 }
61 63
62 const char* MediaLog::PipelineStatusToString(PipelineStatus status) { 64 const char* MediaLog::PipelineStatusToString(PipelineStatus status) {
63 switch (status) { 65 switch (status) {
64 case PIPELINE_OK: 66 case PIPELINE_OK:
65 return "pipeline: ok"; 67 return "pipeline: ok";
66 case PIPELINE_ERROR_URL_NOT_FOUND: 68 case PIPELINE_ERROR_URL_NOT_FOUND:
(...skipping 24 matching lines...) Expand all
91 return "demuxer: no supported streams"; 93 return "demuxer: no supported streams";
92 case DECODER_ERROR_NOT_SUPPORTED: 94 case DECODER_ERROR_NOT_SUPPORTED:
93 return "decoder: not supported"; 95 return "decoder: not supported";
94 case PIPELINE_STATUS_MAX: 96 case PIPELINE_STATUS_MAX:
95 NOTREACHED(); 97 NOTREACHED();
96 } 98 }
97 NOTREACHED(); 99 NOTREACHED();
98 return NULL; 100 return NULL;
99 } 101 }
100 102
103 ErrorLogHelper::ErrorLogHelper(const ErrorLogCB& error_cb)
104 : error_cb_(error_cb) {
105 }
106
107 ErrorLogHelper::~ErrorLogHelper() {
108 if (error_cb_.is_null())
109 return;
110 error_cb_.Run(stream_.str());
111 }
112
101 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {} 113 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {}
102 114
103 MediaLog::~MediaLog() {} 115 MediaLog::~MediaLog() {}
104 116
105 void MediaLog::AddEvent(scoped_ptr<MediaLogEvent> event) {} 117 void MediaLog::AddEvent(scoped_ptr<MediaLogEvent> event) {}
106 118
107 scoped_ptr<MediaLogEvent> MediaLog::CreateEvent(MediaLogEvent::Type type) { 119 scoped_ptr<MediaLogEvent> MediaLog::CreateEvent(MediaLogEvent::Type type) {
108 scoped_ptr<MediaLogEvent> event(new MediaLogEvent); 120 scoped_ptr<MediaLogEvent> event(new MediaLogEvent);
109 event->id = id_; 121 event->id = id_;
110 event->type = type; 122 event->type = type;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( 183 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent(
172 size_t start, size_t current, size_t end) { 184 size_t start, size_t current, size_t end) {
173 scoped_ptr<MediaLogEvent> event( 185 scoped_ptr<MediaLogEvent> event(
174 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); 186 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED));
175 event->params.SetInteger("buffer_start", start); 187 event->params.SetInteger("buffer_start", start);
176 event->params.SetInteger("buffer_current", current); 188 event->params.SetInteger("buffer_current", current);
177 event->params.SetInteger("buffer_end", end); 189 event->params.SetInteger("buffer_end", end);
178 return event.Pass(); 190 return event.Pass();
179 } 191 }
180 192
193 scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent(
194 const std::string& error) {
195 scoped_ptr<MediaLogEvent> event(
196 CreateEvent(MediaLogEvent::MEDIA_SOURCE_ERROR));
197 event->params.SetString("error", error);
198 return event.Pass();
199 }
200
181 } //namespace media 201 } //namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698