diff options
author | dongseong.hwang <dongseong.hwang@intel.com> | 2015-02-11 12:07:36 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-11 20:08:47 +0000 |
commit | 16e17206be4635966d3ee5a4bf28bcce9cde5d3f (patch) | |
tree | ba315587170f910f3eb81f33d6110cba3eeb2877 /cc | |
parent | cd38a84418d8d192199016af8c3902e6fea61d5a (diff) | |
download | chromium_src-16e17206be4635966d3ee5a4bf28bcce9cde5d3f.zip chromium_src-16e17206be4635966d3ee5a4bf28bcce9cde5d3f.tar.gz chromium_src-16e17206be4635966d3ee5a4bf28bcce9cde5d3f.tar.bz2 |
gpu video: optimize HW video to SW canvas and implement it for WebRTC.
Currently, very complicated callback mechanism is used to copy HW video to SW
canvas in SkCanvasVideoRenderer. When Blink thread needs to readback HW video,
the readback callback of VideoFrame is called, and then readback is executed in the
media thread using gl context belonging to gpu decoder.
It has two bad points:
1. Blink thread is blocked until the media thread gets readback done.
2. It's not implemented yet for WebRTC HW Video to be drawn on SW Canvas.
In detail for #2, VideoCaptureImpl creates a texture VideoFrame using the
mailbox made in browser process. VideoCaptureImpl doesn't use any gl context so
the readback callback is not implemented. Now the callback is removed.
This CL implements drawing HW Video on SW SkCanvas in SkCanvasVideoRenderer, so
two bad points are resolved.
1. SkCanvasVideoRenderer draws HW Video on SW SkCanvas in Blink thread without
interaction with the media thread.
2. WebRTC impl (i.e. VideoCaptureImpl) doesn't need to do anything because
SkCanvasVideoRenderer has all logic to draw HW Video on SW SkCanvas.
TEST=blink layout test virtual/gpu/fast/canvas/yuv-video-on-accelerated-canvas.html
BUG=401058
Review URL: https://codereview.chromium.org/850993002
Cr-Commit-Position: refs/heads/master@{#315819}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/resources/video_resource_updater.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_context.cc | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc index 6375057..0e772eb 100644 --- a/cc/resources/video_resource_updater.cc +++ b/cc/resources/video_resource_updater.cc @@ -296,7 +296,9 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes( ResourceProvider::ScopedWriteLockSoftware lock( resource_provider_, plane_resource.resource_id); SkCanvas canvas(lock.sk_bitmap()); - video_renderer_->Copy(video_frame, &canvas); + // This is software path, so canvas and video_frame are always backed + // by software. + video_renderer_->Copy(video_frame, &canvas, media::Context3D()); SetPlaneResourceUniqueId(video_frame.get(), 0, &plane_resource); } diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index 56e52ad..596adc0 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc @@ -1081,14 +1081,12 @@ class LayerTreeHostContextTestDontUseLostResources make_scoped_ptr( new gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, sync_point)), media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4), - gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), base::TimeDelta(), - VideoFrame::ReadPixelsCB(), false); + gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), base::TimeDelta(), false); scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( make_scoped_ptr( new gpu::MailboxHolder(mailbox, GL_TEXTURE_2D, sync_point)), media::VideoFrame::ReleaseMailboxCB(), gfx::Size(4, 4), - gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), base::TimeDelta(), - VideoFrame::ReadPixelsCB(), false); + gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), base::TimeDelta(), false); color_frame_provider_.set_frame(color_video_frame_); hw_frame_provider_.set_frame(hw_video_frame_); |