diff options
author | changbin.shao@intel.com <changbin.shao@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 08:50:01 +0000 |
---|---|---|
committer | changbin.shao@intel.com <changbin.shao@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 08:50:01 +0000 |
commit | f4521f66690be0f8c2669d71915b6e58350f23d4 (patch) | |
tree | 61e12862d72749eba0ad7d2a040121f5607a85c9 | |
parent | 7b17bd00c3b044e9e01d01c8bfb589a5e99e99e5 (diff) | |
download | chromium_src-f4521f66690be0f8c2669d71915b6e58350f23d4.zip chromium_src-f4521f66690be0f8c2669d71915b6e58350f23d4.tar.gz chromium_src-f4521f66690be0f8c2669d71915b6e58350f23d4.tar.bz2 |
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
-rw-r--r-- | media/base/media_log.cc | 12 | ||||
-rw-r--r-- | media/base/media_log.h | 2 | ||||
-rw-r--r-- | media/base/media_log_event.h | 7 | ||||
-rw-r--r-- | media/base/pipeline.cc | 2 |
4 files changed, 23 insertions, 0 deletions
diff --git a/media/base/media_log.cc b/media/base/media_log.cc index abd845b..8ac5171 100644 --- a/media/base/media_log.cc +++ b/media/base/media_log.cc @@ -56,6 +56,8 @@ const char* MediaLog::EventTypeToString(MediaLogEvent::Type type) { return "BUFFERED_EXTENTS_CHANGED"; case MediaLogEvent::MEDIA_SOURCE_ERROR: return "MEDIA_SOURCE_ERROR"; + case MediaLogEvent::PIPELINE_STATISTICS_CHANGED: + return "PIPELINE_STATISTICS_CHANGED"; } NOTREACHED(); return NULL; @@ -196,4 +198,14 @@ scoped_ptr<MediaLogEvent> MediaLog::CreateMediaSourceErrorEvent( 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 diff --git a/media/base/media_log.h b/media/base/media_log.h index e776ef6..cfb16e0 100644 --- a/media/base/media_log.h +++ b/media/base/media_log.h @@ -67,6 +67,8 @@ class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { size_t start, size_t current, size_t end); scoped_ptr<MediaLogEvent> CreateMediaSourceErrorEvent( const std::string& error); + scoped_ptr<MediaLogEvent> CreatePipelineStatisticsChangedEvent( + const PipelineStatistics& stats); protected: friend class base::RefCountedThreadSafe<MediaLog>; diff --git a/media/base/media_log_event.h b/media/base/media_log_event.h index 9b0f6e1..11ef5a0 100644 --- a/media/base/media_log_event.h +++ b/media/base/media_log_event.h @@ -72,6 +72,13 @@ struct MediaLogEvent { // Errors reported by Media Source Extensions code. MEDIA_SOURCE_ERROR, // 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; diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc index 1b88deb..e656ef3 100644 --- a/media/base/pipeline.cc +++ b/media/base/pipeline.cc @@ -720,6 +720,8 @@ void Pipeline::OnUpdateStatistics(const PipelineStatistics& stats) { statistics_.video_bytes_decoded += stats.video_bytes_decoded; statistics_.video_frames_decoded += stats.video_frames_decoded; statistics_.video_frames_dropped += stats.video_frames_dropped; + media_log_->AddEvent( + media_log_->CreatePipelineStatisticsChangedEvent(statistics_)); } void Pipeline::StartTask(scoped_ptr<FilterCollection> filter_collection, |