diff options
author | dalecurtis <dalecurtis@chromium.org> | 2015-05-01 00:08:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-01 07:09:00 +0000 |
commit | f28f0e50dd756f424541a734cfa8fc5f8542c57a (patch) | |
tree | 01330c15cf04a850c48671df696fccfc534f2f19 /cc | |
parent | d9918c29c51ca7a1405ed99a7503e1a33db658da (diff) | |
download | chromium_src-f28f0e50dd756f424541a734cfa8fc5f8542c57a.zip chromium_src-f28f0e50dd756f424541a734cfa8fc5f8542c57a.tar.gz chromium_src-f28f0e50dd756f424541a734cfa8fc5f8542c57a.tar.bz2 |
Connect the new video rendering path to the compositor.
Hooks up the new VideoRendererAlgorithm to the VideoRendererImpl and it
to the VideoRendererSink (VideoFrameCompositor) which finally talks to
the VideoFrameProviderClientImpl!
All of this is behind a new flag: --enable-new-video-renderer for right
now. We'll slowly ramp it up based on crash and YouTube metrics. It is
also available via chrome://flags for our YT friends to test immediately.
The playback experience is significantly smoother, dropped frame counts
are significantly more accurate, power consumption is much lower in
background tabs, and slightly lower in the foreground!
Smoothness scores (windows):
New:
24: Smoothness: 98.750000, Freezing: 100.000000, ~Dropped: 29 / 749 (3.871829%)
30: Smoothness: 99.330000, Freezing: 100.000000, ~Dropped: 0 / 900 (0.000000%)
60: Smoothness: 99.280000, Freezing: 99.670000, ~Dropped: 6 / 1800 (0.333333%)
Old:
24: Smoothness: 92.640000, Freezing: 100.000000, ~Dropped: 29 / 749 (3.871829%)
30: Smoothness: 68.490000, Freezing: 99.440000, ~Dropped: 5 / 900 (0.555556%)
60: Smoothness: 99.280000, Freezing: 99.670000, ~Dropped: 6 / 1800 (0.333333%)
See http://xorax.sea/barcode/results_win/ for further details.
Power consumption metrics on OSX for 1080p VP9 playback averaged over 10 runs:
New:
energy_consumption_mwh: 38.994639mWh
idle_wakeups_total: 1459.600000count
cpu_utilization (browser): 4.752003%
cpu_utilization (gpu): 7.791677%
cpu_utilization (renderer): 74.691065%
Old:
energy_consumption_mwh: 39.114139mWh
idle_wakeups_total: 1947.900000count
cpu_utilization (browser): 5.125488%
cpu_utilization (gpu): 8.624919%
cpu_utilization (renderer): 84.009566%
New Background:
energy_consumption_mwh: 31.402967mWh
idle_wakeups_total: 195.500000count
cpu_utilization (browser): 1.594367%
cpu_utilization (gpu): 0.154281%
cpu_utilization (renderer): 49.920668%
Old Background:
energy_consumption_mwh: 42.224069mWh
idle_wakeups_total: 522.200000count
cpu_utilization (browser): 1.629945%
cpu_utilization (gpu): 0.155414%
cpu_utilization (renderer): 63.333668%
See http://xorax.sea/barcode/results_osx/ for the full run details. I wouldn't
trust the absolute values for cpu or energy consumption, but the relative
difference should be meaningful.
This clamps background canvas updates from video to once every 250ms,
but in practice I couldn't tell the difference when tab switching in
a debug build.
BUG=386551, 396803, 438680, 438766, 439548, 460190
TEST=manual playback, unit tests
TBR=asvitkine
Review URL: https://codereview.chromium.org/1083383005
Cr-Commit-Position: refs/heads/master@{#327889}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/layers/video_frame_provider_client_impl.cc | 40 | ||||
-rw-r--r-- | cc/layers/video_frame_provider_client_impl.h | 1 |
2 files changed, 34 insertions, 7 deletions
diff --git a/cc/layers/video_frame_provider_client_impl.cc b/cc/layers/video_frame_provider_client_impl.cc index 3ca39ef..17bf3e6 100644 --- a/cc/layers/video_frame_provider_client_impl.cc +++ b/cc/layers/video_frame_provider_client_impl.cc @@ -24,7 +24,8 @@ VideoFrameProviderClientImpl::VideoFrameProviderClientImpl( : provider_(provider), client_(client), active_video_layer_(nullptr), - stopped_(false) { + stopped_(false), + rendering_(false) { // This only happens during a commit on the compositor thread while the main // thread is blocked. That makes this a thread-safe call to set the video // frame provider client that does not require a lock. The same is true of @@ -64,7 +65,8 @@ void VideoFrameProviderClientImpl::Stop() { provider_->SetVideoFrameProviderClient(nullptr); provider_ = nullptr; } - client_->RemoveVideoFrameController(this); + if (rendering_) + StopRendering(); active_video_layer_ = nullptr; stopped_ = true; } @@ -107,16 +109,26 @@ void VideoFrameProviderClientImpl::StopUsingProvider() { // using the frame. base::AutoLock locker(provider_lock_); provider_ = nullptr; + if (rendering_) + StopRendering(); } void VideoFrameProviderClientImpl::StartRendering() { - // TODO(dalecurtis, sunnyps): Hook this method up to control when to start - // observing vsync intervals. http://crbug.com/336733 + DCHECK(thread_checker_.CalledOnValidThread()); + TRACE_EVENT0("cc", "VideoFrameProviderClientImpl::StartRendering"); + DCHECK(!rendering_); + DCHECK(!stopped_); + client_->AddVideoFrameController(this); + rendering_ = true; } void VideoFrameProviderClientImpl::StopRendering() { - // TODO(dalecurtis, sunnyps): Hook this method up to control when to stop - // observing vsync intervals. http://crbug.com/336733 + DCHECK(thread_checker_.CalledOnValidThread()); + TRACE_EVENT0("cc", "VideoFrameProviderClientImpl::StopRendering"); + DCHECK(rendering_); + DCHECK(!stopped_); + client_->RemoveVideoFrameController(this); + rendering_ = false; } void VideoFrameProviderClientImpl::DidReceiveFrame() { @@ -142,7 +154,21 @@ void VideoFrameProviderClientImpl::DidUpdateMatrix(const float* matrix) { void VideoFrameProviderClientImpl::OnBeginFrame(const BeginFrameArgs& args) { DCHECK(thread_checker_.CalledOnValidThread()); - NOTIMPLEMENTED(); + DCHECK(rendering_); + DCHECK(!stopped_); + + TRACE_EVENT0("cc", "VideoFrameProviderClientImpl::OnBeginFrame"); + base::AutoLock locker(provider_lock_); + + // We use frame_time + interval here because that is the estimated time at + // which a frame returned during this phase will end up being displayed. + if (!provider_ || + !provider_->UpdateCurrentFrame(args.frame_time + args.interval, + args.frame_time + 2 * args.interval)) { + return; + } + + DidReceiveFrame(); } } // namespace cc diff --git a/cc/layers/video_frame_provider_client_impl.h b/cc/layers/video_frame_provider_client_impl.h index c9470ba..be49e15 100644 --- a/cc/layers/video_frame_provider_client_impl.h +++ b/cc/layers/video_frame_provider_client_impl.h @@ -68,6 +68,7 @@ class CC_EXPORT VideoFrameProviderClientImpl VideoFrameControllerClient* client_; VideoLayerImpl* active_video_layer_; bool stopped_; + bool rendering_; // Since the provider lives on another thread, it can be destroyed while the // frame controller are accessing its frame. Before being destroyed the |