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

Side by Side Diff: content/browser/renderer_host/media/web_contents_video_capture_device.cc

Issue 12881005: Allow CopyFromBackingStore to fallback to copying from the renderer side if the accelerated surface… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unused include Created 7 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Implementation notes: This needs to work on a variety of hardware 5 // Implementation notes: This needs to work on a variety of hardware
6 // configurations where the speed of the CPU and GPU greatly affect overall 6 // configurations where the speed of the CPU and GPU greatly affect overall
7 // performance. Spanning several threads, the process of capturing has been 7 // performance. Spanning several threads, the process of capturing has been
8 // split up into four conceptual stages: 8 // split up into four conceptual stages:
9 // 9 //
10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the consumer's 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the consumer's
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 // Measure the number of kilopixels. 982 // Measure the number of kilopixels.
983 UMA_HISTOGRAM_COUNTS_10000( 983 UMA_HISTOGRAM_COUNTS_10000(
984 "TabCapture.ViewChangeKiloPixels", 984 "TabCapture.ViewChangeKiloPixels",
985 view_size.width() * view_size.height() / 1024); 985 view_size.width() * view_size.height() / 1024);
986 } 986 }
987 } 987 }
988 988
989 TRACE_EVENT_ASYNC_BEGIN1("mirroring", "Capture", this, 989 TRACE_EVENT_ASYNC_BEGIN1("mirroring", "Capture", this,
990 "frame_number", frame_number); 990 "frame_number", frame_number);
991 991
992 if (view && view->CanCopyToVideoFrame()) { 992 if (!view->IsSurfaceAvailableForCopy()) {
993 // Fallback to the more expensive renderer-side copy if the surface and
994 // backing store are not accessible.
995 rwh->GetSnapshotFromRenderer(
996 gfx::Rect(),
997 base::Bind(&BackingStoreCopier::DidCopyFromBackingStore,
998 base::Unretained(this), frame_number,
999 base::Time::Now(), callback));
1000 } else if (view && view->CanCopyToVideoFrame()) {
993 gfx::Size view_size = view->GetViewBounds().size(); 1001 gfx::Size view_size = view->GetViewBounds().size();
994 1002
995 view->CopyFromCompositingSurfaceToVideoFrame( 1003 view->CopyFromCompositingSurfaceToVideoFrame(
996 gfx::Rect(view_size), 1004 gfx::Rect(view_size),
997 target, 1005 target,
998 base::Bind( 1006 base::Bind(
999 &BackingStoreCopier::DidCopyFromCompositingSurfaceToVideoFrame, 1007 &BackingStoreCopier::DidCopyFromCompositingSurfaceToVideoFrame,
1000 base::Unretained(this), frame_number, 1008 base::Unretained(this), frame_number,
1001 base::Time::Now(), callback)); 1009 base::Time::Now(), callback));
1002 } else { 1010 } else {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 capturer_->SetConsumer(NULL); 1120 capturer_->SetConsumer(NULL);
1113 capturer_->DeAllocate(); 1121 capturer_->DeAllocate();
1114 } 1122 }
1115 1123
1116 const media::VideoCaptureDevice::Name& 1124 const media::VideoCaptureDevice::Name&
1117 WebContentsVideoCaptureDevice::device_name() { 1125 WebContentsVideoCaptureDevice::device_name() {
1118 return device_name_; 1126 return device_name_;
1119 } 1127 }
1120 1128
1121 } // namespace content 1129 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698