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

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

Issue 188633002: Query the preferred readback config in CopyFromBackingStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Preferred format support for all functions. Created 6 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 client's 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the client's
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 start_time, target, deliver_frame_cb)); 659 start_time, target, deliver_frame_cb));
660 } else if (view->CanCopyToVideoFrame()) { 660 } else if (view->CanCopyToVideoFrame()) {
661 view->CopyFromCompositingSurfaceToVideoFrame( 661 view->CopyFromCompositingSurfaceToVideoFrame(
662 gfx::Rect(view_size), 662 gfx::Rect(view_size),
663 target, 663 target,
664 base::Bind(&WebContentsCaptureMachine:: 664 base::Bind(&WebContentsCaptureMachine::
665 DidCopyFromCompositingSurfaceToVideoFrame, 665 DidCopyFromCompositingSurfaceToVideoFrame,
666 weak_ptr_factory_.GetWeakPtr(), 666 weak_ptr_factory_.GetWeakPtr(),
667 start_time, deliver_frame_cb)); 667 start_time, deliver_frame_cb));
668 } else { 668 } else {
669 SkBitmap::Config preffered_format = rwh->PreferredReadbackFormat();
piman 2014/03/10 18:27:20 typo: preferred_format
sivag 2014/03/11 14:41:50 Done.
669 rwh->CopyFromBackingStore( 670 rwh->CopyFromBackingStore(
670 gfx::Rect(), 671 gfx::Rect(),
671 fitted_size, // Size here is a request not always honored. 672 fitted_size, // Size here is a request not always honored.
672 base::Bind(&WebContentsCaptureMachine::DidCopyFromBackingStore, 673 base::Bind(&WebContentsCaptureMachine::DidCopyFromBackingStore,
673 weak_ptr_factory_.GetWeakPtr(), 674 weak_ptr_factory_.GetWeakPtr(),
674 start_time, target, deliver_frame_cb)); 675 start_time,
676 target,
677 deliver_frame_cb),
678 preffered_format);
piman 2014/03/10 18:27:20 The receiving code only accepts RGBA8888, see Rend
sivag 2014/03/11 14:41:50 Done.
675 } 679 }
676 } 680 }
677 681
678 bool WebContentsCaptureMachine::StartObservingWebContents() { 682 bool WebContentsCaptureMachine::StartObservingWebContents() {
679 // Look-up the RenderViewHost and, from that, the WebContents that wraps it. 683 // Look-up the RenderViewHost and, from that, the WebContents that wraps it.
680 // If successful, begin observing the WebContents instance. 684 // If successful, begin observing the WebContents instance.
681 // 685 //
682 // Why this can be unsuccessful: The request for mirroring originates in a 686 // Why this can be unsuccessful: The request for mirroring originates in a
683 // render process, and this request is based on the current RenderView 687 // render process, and this request is based on the current RenderView
684 // associated with a tab. However, by the time we get up-and-running here, 688 // associated with a tab. However, by the time we get up-and-running here,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 scoped_ptr<Client> client) { 822 scoped_ptr<Client> client) {
819 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); 823 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
820 core_->AllocateAndStart(params, client.Pass()); 824 core_->AllocateAndStart(params, client.Pass());
821 } 825 }
822 826
823 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { 827 void WebContentsVideoCaptureDevice::StopAndDeAllocate() {
824 core_->StopAndDeAllocate(); 828 core_->StopAndDeAllocate();
825 } 829 }
826 830
827 } // namespace content 831 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698