Expose MEDIA_STATISTICS stats to chrome://media-internals.

Introduce MEDIA_STATISTICS parameters, such as decodedVideoFrameCount and friends, to chrome://media-internals properties.

BUG=178563

Review URL: https://chromiumcodereview.appspot.com/13870004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195111 0039d316-1c4b-4281-b951-d872f2087c98
parent 7b17bd00
...@@ -56,6 +56,8 @@ const char* MediaLog::EventTypeToString(MediaLogEvent::Type type) { ...@@ -56,6 +56,8 @@ const char* MediaLog::EventTypeToString(MediaLogEvent::Type type) {
return "BUFFERED_EXTENTS_CHANGED"; return "BUFFERED_EXTENTS_CHANGED";
case MediaLogEvent::MEDIA_SOURCE_ERROR: case MediaLogEvent::MEDIA_SOURCE_ERROR:
return "MEDIA_SOURCE_ERROR"; return "MEDIA_SOURCE_ERROR";
case MediaLogEvent::PIPELINE_STATISTICS_CHANGED:
return "PIPELINE_STATISTICS_CHANGED";
} }
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
...@@ -196,4 +198,14 @@ scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent( ...@@ -196,4 +198,14 @@ scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent(
return event.Pass(); return event.Pass();
} }
scoped_ptr<MediaLogEvent> MediaLog::CreatePipelineStatisticsChangedEvent(
const PipelineStatistics& stats) {
scoped_ptr<MediaLogEvent> event(
CreateEvent(MediaLogEvent::PIPELINE_STATISTICS_CHANGED));
event->params.SetInteger("decoded_audio_bytes", stats.audio_bytes_decoded);
event->params.SetInteger("decoded_video_bytes", stats.video_bytes_decoded);
event->params.SetInteger("decoded_video_frames", stats.video_frames_decoded);
event->params.SetInteger("dropped_video_frames", stats.video_frames_dropped);
return event.Pass();
}
} //namespace media } //namespace media
...@@ -67,6 +67,8 @@ class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { ...@@ -67,6 +67,8 @@ class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> {
size_t start, size_t current, size_t end); size_t start, size_t current, size_t end);
scoped_ptr<MediaLogEvent> CreateMediaSourceErrorEvent( scoped_ptr<MediaLogEvent> CreateMediaSourceErrorEvent(
const std::string& error); const std::string& error);
scoped_ptr<MediaLogEvent> CreatePipelineStatisticsChangedEvent(
const PipelineStatistics& stats);
protected: protected:
friend class base::RefCountedThreadSafe<MediaLog>; friend class base::RefCountedThreadSafe<MediaLog>;
......
...@@ -72,6 +72,13 @@ struct MediaLogEvent { ...@@ -72,6 +72,13 @@ struct MediaLogEvent {
// Errors reported by Media Source Extensions code. // Errors reported by Media Source Extensions code.
MEDIA_SOURCE_ERROR, MEDIA_SOURCE_ERROR,
// params: "error": Error string describing the error detected. // params: "error": Error string describing the error detected.
// Statistics for pipeline.
// params: "decoded_audio_bytes": <decoded audio bytes of the video>
// "decoded_video_bytes": <decoded video bytes of the video>
// "decoded_video_frames": <decoded video frames of the video>
// "dropped_video_frames": <dropped video frames of the video>
PIPELINE_STATISTICS_CHANGED,
}; };
int32 id; int32 id;
......
...@@ -720,6 +720,8 @@ void Pipeline::OnUpdateStatistics(const PipelineStatistics& stats) { ...@@ -720,6 +720,8 @@ void Pipeline::OnUpdateStatistics(const PipelineStatistics& stats) {
statistics_.video_bytes_decoded += stats.video_bytes_decoded; statistics_.video_bytes_decoded += stats.video_bytes_decoded;
statistics_.video_frames_decoded += stats.video_frames_decoded; statistics_.video_frames_decoded += stats.video_frames_decoded;
statistics_.video_frames_dropped += stats.video_frames_dropped; statistics_.video_frames_dropped += stats.video_frames_dropped;
media_log_->AddEvent(
media_log_->CreatePipelineStatisticsChangedEvent(statistics_));
} }
void Pipeline::StartTask(scoped_ptr<FilterCollection> filter_collection, void Pipeline::StartTask(scoped_ptr<FilterCollection> filter_collection,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment