diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 01:26:28 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-30 01:26:28 +0000 |
commit | b57509eb8033560cc25bd178ccb3c2cc1accc9b3 (patch) | |
tree | 729741b9675e921501fadc71149faab6f43565fb /webkit | |
parent | 7338054b55aa018614d23084adfa1649deccf2c6 (diff) | |
download | chromium_src-b57509eb8033560cc25bd178ccb3c2cc1accc9b3.zip chromium_src-b57509eb8033560cc25bd178ccb3c2cc1accc9b3.tar.gz chromium_src-b57509eb8033560cc25bd178ccb3c2cc1accc9b3.tar.bz2 |
Added --enable-video-logging, which will log the presentation timestamp of video frames.
In conjunction with a log parser we can detect dropped frames and our display jitter.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1398001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/media/video_renderer_impl.cc | 26 | ||||
-rw-r--r-- | webkit/glue/media/video_renderer_impl.h | 25 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 3 |
3 files changed, 40 insertions, 14 deletions
diff --git a/webkit/glue/media/video_renderer_impl.cc b/webkit/glue/media/video_renderer_impl.cc index 50c29ca..3d090b8 100644 --- a/webkit/glue/media/video_renderer_impl.cc +++ b/webkit/glue/media/video_renderer_impl.cc @@ -2,16 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "webkit/glue/media/video_renderer_impl.h" + #include "media/base/video_frame.h" #include "media/base/yuv_convert.h" -#include "webkit/glue/media/video_renderer_impl.h" #include "webkit/glue/webmediaplayer_impl.h" namespace webkit_glue { - VideoRendererImpl::VideoRendererImpl(WebMediaPlayerImpl::Proxy* proxy) +VideoRendererImpl::VideoRendererImpl(WebMediaPlayerImpl::Proxy* proxy, + bool pts_logging) : proxy_(proxy), - last_converted_frame_(NULL) { + last_converted_frame_(NULL), + pts_logging_(pts_logging) { // TODO(hclam): decide whether to do the following line in this thread or // in the render thread. proxy->SetVideoRenderer(this); @@ -19,9 +22,11 @@ namespace webkit_glue { // static media::FilterFactory* VideoRendererImpl::CreateFactory( - WebMediaPlayerImpl::Proxy* proxy) { - return new media::FilterFactoryImpl1<VideoRendererImpl, - WebMediaPlayerImpl::Proxy*>(proxy); + WebMediaPlayerImpl::Proxy* proxy, + bool pts_logging) { + return new media::FilterFactoryImpl2<VideoRendererImpl, + WebMediaPlayerImpl::Proxy*, + bool>(proxy, pts_logging); } // static @@ -74,6 +79,15 @@ void VideoRendererImpl::Paint(skia::PlatformCanvas* canvas, } else { SlowPaint(video_frame, canvas, dest_rect); } + + // Presentation timestamp logging is primarily used to measure performance + // on low-end devices. When profiled on an Intel Atom N280 @ 1.66GHz this + // code had a ~63 microsecond perf hit when logging to a file (not stdout), + // which is neglible enough for measuring playback performance. + if (pts_logging_) { + LOG(INFO) << "pts=" + << video_frame->GetTimestamp().InMicroseconds(); + } video_frame = NULL; } } diff --git a/webkit/glue/media/video_renderer_impl.h b/webkit/glue/media/video_renderer_impl.h index b2018e9..61e6ea1 100644 --- a/webkit/glue/media/video_renderer_impl.h +++ b/webkit/glue/media/video_renderer_impl.h @@ -29,22 +29,29 @@ class VideoRendererImpl : public WebVideoRenderer { virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& dest_rect); // Static method for creating factory for this object. - static media::FilterFactory* CreateFactory(WebMediaPlayerImpl::Proxy* proxy); + static media::FilterFactory* CreateFactory(WebMediaPlayerImpl::Proxy* proxy, + bool pts_logging); - // FilterFactoryImpl1 implementation. + // FilterFactoryImpl2 implementation. static bool IsMediaFormatSupported(const media::MediaFormat& media_format); // TODO(scherkus): remove this mega-hack, see http://crbug.com/28207 class FactoryFactory : public webkit_glue::WebVideoRendererFactoryFactory { public: - FactoryFactory() : webkit_glue::WebVideoRendererFactoryFactory() {} + FactoryFactory(bool pts_logging) + : webkit_glue::WebVideoRendererFactoryFactory(), + pts_logging_(pts_logging) { + } virtual media::FilterFactory* CreateFactory( webkit_glue::WebMediaPlayerImpl::Proxy* proxy) { - return VideoRendererImpl::CreateFactory(proxy); + return VideoRendererImpl::CreateFactory(proxy, pts_logging_); } private: + // Whether we're logging video presentation timestamps (PTS). + bool pts_logging_; + DISALLOW_COPY_AND_ASSIGN(FactoryFactory); }; @@ -60,9 +67,10 @@ class VideoRendererImpl : public WebVideoRenderer { private: // Only the filter factories can create instances. - friend class media::FilterFactoryImpl1<VideoRendererImpl, - WebMediaPlayerImpl::Proxy*>; - explicit VideoRendererImpl(WebMediaPlayerImpl::Proxy* proxy); + friend class media::FilterFactoryImpl2<VideoRendererImpl, + WebMediaPlayerImpl::Proxy*, + bool>; + VideoRendererImpl(WebMediaPlayerImpl::Proxy* proxy, bool pts_logging); virtual ~VideoRendererImpl() {} // Determine the conditions to perform fast paint. Returns true if we can do @@ -103,6 +111,9 @@ class VideoRendererImpl : public WebVideoRenderer { // The size of the video. gfx::Size video_size_; + // Whether we're logging video presentation timestamps (PTS). + bool pts_logging_; + DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); }; diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index 5c599e0..427e6a6 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -118,7 +118,8 @@ WebKit::WebMediaPlayer* CreateMediaPlayer(WebFrame* frame, factory->AddFactory(buffered_data_source_factory); factory->AddFactory(simple_data_source_factory); return new webkit_glue::WebMediaPlayerImpl( - client, factory, new webkit_glue::VideoRendererImpl::FactoryFactory()); + client, factory, + new webkit_glue::VideoRendererImpl::FactoryFactory(false)); } // Bridge for SimpleDatabaseSystem |