From 4c51bc66e6496234d5a3a7cbdfb1cf07cca2167e Mon Sep 17 00:00:00 2001 From: "scherkus@chromium.org" Date: Wed, 16 Feb 2011 02:03:16 +0000 Subject: Implement webkit media metrics in chromium. This implements the chromium side of the webkit media statistics feature. A followup cl (in webkit) will wire the two sides together. Patch by sjl@chromium.org: http://codereview.chromium.org/6246091/ BUG=71255 TEST=media_unittests git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75050 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/gpu/gpu_video_decoder.cc | 5 ++++- chrome/gpu/gpu_video_decoder.h | 6 ++++-- chrome/gpu/gpu_video_decoder_unittest.cc | 4 +++- chrome/gpu/media/fake_gl_video_decode_engine.cc | 4 ++-- chrome/gpu/media/fake_gl_video_decode_engine.h | 4 ++++ 5 files changed, 17 insertions(+), 6 deletions(-) (limited to 'chrome/gpu') diff --git a/chrome/gpu/gpu_video_decoder.cc b/chrome/gpu/gpu_video_decoder.cc index ee213bf..c1210d4 100644 --- a/chrome/gpu/gpu_video_decoder.cc +++ b/chrome/gpu/gpu_video_decoder.cc @@ -121,7 +121,10 @@ void GpuVideoDecoder::ProduceVideoSample(scoped_refptr buffer) { SendEmptyBufferDone(); } -void GpuVideoDecoder::ConsumeVideoFrame(scoped_refptr frame) { +void GpuVideoDecoder::ConsumeVideoFrame(scoped_refptr frame, + const PipelineStatistics& statistics) { + // TODO(sjl): Do something with the statistics... + if (frame->IsEndOfStream()) { SendConsumeVideoFrame(kGpuVideoInvalidFrameId, 0, 0, kGpuVideoEndOfStream); return; diff --git a/chrome/gpu/gpu_video_decoder.h b/chrome/gpu/gpu_video_decoder.h index ae1da3b..5fcd5cc 100644 --- a/chrome/gpu/gpu_video_decoder.h +++ b/chrome/gpu/gpu_video_decoder.h @@ -18,11 +18,12 @@ #include "media/video/video_decode_engine.h" #include "ipc/ipc_channel.h" +using media::Buffer; +using media::PipelineStatistics; using media::VideoCodecConfig; using media::VideoCodecInfo; using media::VideoStreamInfo; using media::VideoFrame; -using media::Buffer; namespace gpu { namespace gles2 { @@ -112,7 +113,8 @@ class GpuVideoDecoder virtual void OnError(); virtual void OnFormatChange(VideoStreamInfo stream_info); virtual void ProduceVideoSample(scoped_refptr buffer); - virtual void ConsumeVideoFrame(scoped_refptr frame); + virtual void ConsumeVideoFrame(scoped_refptr frame, + const PipelineStatistics& statistics); // VideoDecodeContext implementation. virtual void* GetDevice(); diff --git a/chrome/gpu/gpu_video_decoder_unittest.cc b/chrome/gpu/gpu_video_decoder_unittest.cc index 7767dcd..f88f30c 100644 --- a/chrome/gpu/gpu_video_decoder_unittest.cc +++ b/chrome/gpu/gpu_video_decoder_unittest.cc @@ -8,6 +8,7 @@ #include "chrome/gpu/gpu_video_decoder.h" #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" #include "ipc/ipc_message_utils.h" +#include "media/base/pipeline.h" #include "media/video/video_mock_objects.h" #include "testing/gtest/include/gtest/gtest.h" @@ -62,7 +63,8 @@ ACTION_P(SendVideoFrameAllocated, handler) { } ACTION_P2(SendConsumeVideoFrame, handler, frame) { - handler->ConsumeVideoFrame(frame); + media::PipelineStatistics statistics; + handler->ConsumeVideoFrame(frame, statistics); } class GpuVideoDecoderTest : public testing::Test, diff --git a/chrome/gpu/media/fake_gl_video_decode_engine.cc b/chrome/gpu/media/fake_gl_video_decode_engine.cc index db0f7a5..0e6a696 100644 --- a/chrome/gpu/media/fake_gl_video_decode_engine.cc +++ b/chrome/gpu/media/fake_gl_video_decode_engine.cc @@ -75,7 +75,7 @@ void FakeGlVideoDecodeEngine::Seek() { // *push* decoded frames to downstream. The model used in VideoRendererBase // to wait for *push* is flawed. for (size_t i = 0; i < external_frames_.size(); ++i) - handler_->ConsumeVideoFrame(external_frames_[i]); + handler_->ConsumeVideoFrame(external_frames_[i], dummy_stats_); handler_->OnSeekComplete(); } @@ -126,7 +126,7 @@ void FakeGlVideoDecodeEngine::ProduceVideoFrame( void FakeGlVideoDecodeEngine::UploadCompleteTask( scoped_refptr frame) { // |frame| is the upload target. We can immediately send this frame out. - handler_->ConsumeVideoFrame(frame); + handler_->ConsumeVideoFrame(frame, dummy_stats_); } DISABLE_RUNNABLE_METHOD_REFCOUNT(FakeGlVideoDecodeEngine); diff --git a/chrome/gpu/media/fake_gl_video_decode_engine.h b/chrome/gpu/media/fake_gl_video_decode_engine.h index 24d3b33..9ffe4268 100644 --- a/chrome/gpu/media/fake_gl_video_decode_engine.h +++ b/chrome/gpu/media/fake_gl_video_decode_engine.h @@ -9,6 +9,7 @@ #include #include "base/scoped_ptr.h" +#include "media/base/pipeline.h" #include "media/video/video_decode_engine.h" namespace media { @@ -58,6 +59,9 @@ class FakeGlVideoDecodeEngine : public media::VideoDecodeEngine { // fake pattern in them. std::queue > pending_frames_; + // Dummy statistics. + media::PipelineStatistics dummy_stats_; + DISALLOW_COPY_AND_ASSIGN(FakeGlVideoDecodeEngine); }; -- cgit v1.1