Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: cc/resources/video_resource_updater.cc

Issue 445013002: media: Optimize HW Video to 2D Canvas copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/output/gl_renderer.h" 9 #include "cc/output/gl_renderer.h"
10 #include "cc/resources/media/skcanvas_video_renderer.h"
10 #include "cc/resources/resource_provider.h" 11 #include "cc/resources/resource_provider.h"
11 #include "gpu/GLES2/gl2extchromium.h" 12 #include "gpu/GLES2/gl2extchromium.h"
12 #include "gpu/command_buffer/client/gles2_interface.h" 13 #include "gpu/command_buffer/client/gles2_interface.h"
13 #include "media/base/video_frame.h" 14 #include "media/base/video_frame.h"
14 #include "media/filters/skcanvas_video_renderer.h"
15 #include "third_party/khronos/GLES2/gl2.h" 15 #include "third_party/khronos/GLES2/gl2.h"
16 #include "third_party/khronos/GLES2/gl2ext.h" 16 #include "third_party/khronos/GLES2/gl2ext.h"
17 #include "ui/gfx/size_conversions.h" 17 #include "ui/gfx/size_conversions.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 namespace { 21 namespace {
22 22
23 const ResourceFormat kYUVResourceFormat = LUMINANCE_8; 23 const ResourceFormat kYUVResourceFormat = LUMINANCE_8;
24 const ResourceFormat kRGBResourceFormat = RGBA_8888; 24 const ResourceFormat kRGBResourceFormat = RGBA_8888;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 238
239 VideoFrameExternalResources external_resources; 239 VideoFrameExternalResources external_resources;
240 240
241 if (software_compositor) { 241 if (software_compositor) {
242 DCHECK_EQ(plane_resources.size(), 1u); 242 DCHECK_EQ(plane_resources.size(), 1u);
243 DCHECK_EQ(plane_resources[0].resource_format, kRGBResourceFormat); 243 DCHECK_EQ(plane_resources[0].resource_format, kRGBResourceFormat);
244 DCHECK(plane_resources[0].mailbox.IsZero()); 244 DCHECK(plane_resources[0].mailbox.IsZero());
245 245
246 if (!video_renderer_) 246 if (!video_renderer_)
247 video_renderer_.reset(new media::SkCanvasVideoRenderer); 247 video_renderer_.reset(new SkCanvasVideoRenderer);
248 248
249 { 249 {
250 ResourceProvider::ScopedWriteLockSoftware lock( 250 ResourceProvider::ScopedWriteLockSoftware lock(
251 resource_provider_, plane_resources[0].resource_id); 251 resource_provider_, plane_resources[0].resource_id);
252 lock.sk_canvas()->clear(SK_ColorTRANSPARENT);
252 video_renderer_->Paint(video_frame.get(), 253 video_renderer_->Paint(video_frame.get(),
253 lock.sk_canvas(), 254 lock.sk_canvas(),
254 video_frame->visible_rect(), 255 video_frame->visible_rect(),
255 0xff); 256 0xff,
257 0);
256 } 258 }
257 259
258 RecycleResourceData recycle_data = { 260 RecycleResourceData recycle_data = {
259 plane_resources[0].resource_id, 261 plane_resources[0].resource_id,
260 plane_resources[0].resource_size, 262 plane_resources[0].resource_size,
261 plane_resources[0].resource_format, 263 plane_resources[0].resource_format,
262 gpu::Mailbox() 264 gpu::Mailbox()
263 }; 265 };
264 external_resources.software_resources.push_back( 266 external_resources.software_resources.push_back(
265 plane_resources[0].resource_id); 267 plane_resources[0].resource_id);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 393 }
392 394
393 PlaneResource recycled_resource(data.resource_id, 395 PlaneResource recycled_resource(data.resource_id,
394 data.resource_size, 396 data.resource_size,
395 data.resource_format, 397 data.resource_format,
396 data.mailbox); 398 data.mailbox);
397 updater->recycled_resources_.push_back(recycled_resource); 399 updater->recycled_resources_.push_back(recycled_resource);
398 } 400 }
399 401
400 } // namespace cc 402 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698