| OLD | NEW |
| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.colorType() != kN32_SkColorType || | 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 << ", colorType=" << input.colorType() << ')'; |
| 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) { |
| 483 NOTREACHED(); | 483 NOTREACHED(); |
| 484 return; | 484 return; |
| 485 } | 485 } |
| 486 | 486 |
| 487 // Calculate the width and height of the content region in the |output|, based | 487 // Calculate the width and height of the content region in the |output|, based |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |