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

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

Issue 850993002: gpu video: optimize HW video to SW canvas and implement it for WebRTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 5 years, 11 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 DCHECK(plane_resource.mailbox.IsZero()); 287 DCHECK(plane_resource.mailbox.IsZero());
288 288
289 if (!PlaneResourceMatchesUniqueID(plane_resource, video_frame.get(), 0)) { 289 if (!PlaneResourceMatchesUniqueID(plane_resource, video_frame.get(), 0)) {
290 // We need to transfer data from |video_frame| to the plane resource. 290 // We need to transfer data from |video_frame| to the plane resource.
291 if (!video_renderer_) 291 if (!video_renderer_)
292 video_renderer_.reset(new media::SkCanvasVideoRenderer); 292 video_renderer_.reset(new media::SkCanvasVideoRenderer);
293 293
294 ResourceProvider::ScopedWriteLockSoftware lock( 294 ResourceProvider::ScopedWriteLockSoftware lock(
295 resource_provider_, plane_resource.resource_id); 295 resource_provider_, plane_resource.resource_id);
296 SkCanvas canvas(lock.sk_bitmap()); 296 SkCanvas canvas(lock.sk_bitmap());
297 video_renderer_->Copy(video_frame, &canvas); 297 video_renderer_->Copy(video_frame, &canvas, media::Context3D());
dshwang 2015/01/21 13:40:32 this is software path, so canvas and video_frame a
danakj 2015/02/10 17:48:12 how about making this a comment in the code?
298 SetPlaneResourceUniqueId(video_frame.get(), 0, &plane_resource); 298 SetPlaneResourceUniqueId(video_frame.get(), 0, &plane_resource);
299 } 299 }
300 300
301 external_resources.software_resources.push_back(plane_resource.resource_id); 301 external_resources.software_resources.push_back(plane_resource.resource_id);
302 external_resources.software_release_callback = 302 external_resources.software_release_callback =
303 base::Bind(&RecycleResource, AsWeakPtr(), plane_resource.resource_id); 303 base::Bind(&RecycleResource, AsWeakPtr(), plane_resource.resource_id);
304 external_resources.type = VideoFrameExternalResources::SOFTWARE_RESOURCE; 304 external_resources.type = VideoFrameExternalResources::SOFTWARE_RESOURCE;
305 return external_resources; 305 return external_resources;
306 } 306 }
307 307
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 resource_it->ref_count = 0; 421 resource_it->ref_count = 0;
422 updater->DeleteResource(resource_it); 422 updater->DeleteResource(resource_it);
423 return; 423 return;
424 } 424 }
425 425
426 --resource_it->ref_count; 426 --resource_it->ref_count;
427 DCHECK_GE(resource_it->ref_count, 0); 427 DCHECK_GE(resource_it->ref_count, 0);
428 } 428 }
429 429
430 } // namespace cc 430 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_unittest_context.cc » ('j') | cc/trees/layer_tree_host_unittest_context.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698