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

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: Fix nit. 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
« no previous file with comments | « media/base/media_log.h ('k') | media/base/media_log_event.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 LogHelper::LogHelper(const LogCB& log_cb) : log_cb_(log_cb) {}
104
105 LogHelper::~LogHelper() {
106 if (log_cb_.is_null())
107 return;
108 log_cb_.Run(stream_.str());
109 }
110
101 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {} 111 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {}
102 112
103 MediaLog::~MediaLog() {} 113 MediaLog::~MediaLog() {}
104 114
105 void MediaLog::AddEvent(scoped_ptr<MediaLogEvent> event) {} 115 void MediaLog::AddEvent(scoped_ptr<MediaLogEvent> event) {}
106 116
107 scoped_ptr<MediaLogEvent> MediaLog::CreateEvent(MediaLogEvent::Type type) { 117 scoped_ptr<MediaLogEvent> MediaLog::CreateEvent(MediaLogEvent::Type type) {
108 scoped_ptr<MediaLogEvent> event(new MediaLogEvent); 118 scoped_ptr<MediaLogEvent> event(new MediaLogEvent);
109 event->id = id_; 119 event->id = id_;
110 event->type = type; 120 event->type = type;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( 181 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent(
172 size_t start, size_t current, size_t end) { 182 size_t start, size_t current, size_t end) {
173 scoped_ptr<MediaLogEvent> event( 183 scoped_ptr<MediaLogEvent> event(
174 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); 184 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED));
175 event->params.SetInteger("buffer_start", start); 185 event->params.SetInteger("buffer_start", start);
176 event->params.SetInteger("buffer_current", current); 186 event->params.SetInteger("buffer_current", current);
177 event->params.SetInteger("buffer_end", end); 187 event->params.SetInteger("buffer_end", end);
178 return event.Pass(); 188 return event.Pass();
179 } 189 }
180 190
191 scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent(
192 const std::string& error) {
193 scoped_ptr<MediaLogEvent> event(
194 CreateEvent(MediaLogEvent::MEDIA_SOURCE_ERROR));
195 event->params.SetString("error", error);
196 return event.Pass();
197 }
198
181 } //namespace media 199 } //namespace media
OLDNEW
« no previous file with comments | « media/base/media_log.h ('k') | media/base/media_log_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698