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

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

Issue 374633002: SkBitmap::Config is deprecated, use SkColorType instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments from #4 Created 6 years, 5 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 | Annotate | Revision Log
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 void RenderVideoFrame(const SkBitmap& input, 462 void RenderVideoFrame(const SkBitmap& input,
463 const scoped_refptr<media::VideoFrame>& output, 463 const scoped_refptr<media::VideoFrame>& output,
464 const base::Callback<void(bool)>& done_cb) { 464 const base::Callback<void(bool)>& done_cb) {
465 base::ScopedClosureRunner failure_handler(base::Bind(done_cb, false)); 465 base::ScopedClosureRunner failure_handler(base::Bind(done_cb, false));
466 466
467 SkAutoLockPixels locker(input); 467 SkAutoLockPixels locker(input);
468 468
469 // Sanity-check the captured bitmap. 469 // Sanity-check the captured bitmap.
470 if (input.empty() || 470 if (input.empty() ||
471 !input.readyToDraw() || 471 !input.readyToDraw() ||
472 input.config() != SkBitmap::kARGB_8888_Config || 472 input.colorType() != kN32_SkColorType ||
473 input.width() < 2 || input.height() < 2) { 473 input.width() < 2 || input.height() < 2) {
474 DVLOG(1) << "input unacceptable (size=" 474 DVLOG(1) << "input unacceptable (size="
475 << input.getSize() 475 << input.getSize()
476 << ", ready=" << input.readyToDraw() 476 << ", ready=" << input.readyToDraw()
477 << ", config=" << input.config() << ')'; 477 << ", config=" << input.config() << ')';
478 return; 478 return;
479 } 479 }
480 480
481 // Sanity-check the output buffer. 481 // Sanity-check the output buffer.
482 if (output->format() != media::VideoFrame::I420) { 482 if (output->format() != media::VideoFrame::I420) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 start_time, deliver_frame_cb)); 660 start_time, deliver_frame_cb));
661 } else { 661 } else {
662 rwh->CopyFromBackingStore( 662 rwh->CopyFromBackingStore(
663 gfx::Rect(), 663 gfx::Rect(),
664 fitted_size, // Size here is a request not always honored. 664 fitted_size, // Size here is a request not always honored.
665 base::Bind(&WebContentsCaptureMachine::DidCopyFromBackingStore, 665 base::Bind(&WebContentsCaptureMachine::DidCopyFromBackingStore,
666 weak_ptr_factory_.GetWeakPtr(), 666 weak_ptr_factory_.GetWeakPtr(),
667 start_time, 667 start_time,
668 target, 668 target,
669 deliver_frame_cb), 669 deliver_frame_cb),
670 SkBitmap::kARGB_8888_Config); 670 kN32_SkColorType);
671 } 671 }
672 } 672 }
673 673
674 bool WebContentsCaptureMachine::StartObservingWebContents() { 674 bool WebContentsCaptureMachine::StartObservingWebContents() {
675 // Look-up the RenderViewHost and, from that, the WebContents that wraps it. 675 // Look-up the RenderViewHost and, from that, the WebContents that wraps it.
676 // If successful, begin observing the WebContents instance. 676 // If successful, begin observing the WebContents instance.
677 // 677 //
678 // Why this can be unsuccessful: The request for mirroring originates in a 678 // Why this can be unsuccessful: The request for mirroring originates in a
679 // render process, and this request is based on the current RenderView 679 // render process, and this request is based on the current RenderView
680 // associated with a tab. However, by the time we get up-and-running here, 680 // associated with a tab. However, by the time we get up-and-running here,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 scoped_ptr<Client> client) { 813 scoped_ptr<Client> client) {
814 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); 814 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
815 core_->AllocateAndStart(params, client.Pass()); 815 core_->AllocateAndStart(params, client.Pass());
816 } 816 }
817 817
818 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { 818 void WebContentsVideoCaptureDevice::StopAndDeAllocate() {
819 core_->StopAndDeAllocate(); 819 core_->StopAndDeAllocate();
820 } 820 }
821 821
822 } // namespace content 822 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698