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 consumer's | 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the consumer's |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 input.config() != SkBitmap::kARGB_8888_Config || | 641 input.config() != SkBitmap::kARGB_8888_Config || |
642 input.width() < 2 || input.height() < 2) { | 642 input.width() < 2 || input.height() < 2) { |
643 DVLOG(1) << "input unacceptable (size=" | 643 DVLOG(1) << "input unacceptable (size=" |
644 << input.getSize() | 644 << input.getSize() |
645 << ", ready=" << input.readyToDraw() | 645 << ", ready=" << input.readyToDraw() |
646 << ", config=" << input.config() << ')'; | 646 << ", config=" << input.config() << ')'; |
647 return; | 647 return; |
648 } | 648 } |
649 | 649 |
650 // Sanity-check the output buffer. | 650 // Sanity-check the output buffer. |
651 if (output->format() != media::VideoFrame::YV12) { | 651 if (output->format() != media::VideoFrame::I420) { |
miu
2013/08/08 18:03:31
This shouldn't work: A very subtle detail, but the
sheu
2013/08/08 18:34:09
They're swapped, but we access the frame's data th
| |
652 NOTREACHED(); | 652 NOTREACHED(); |
653 return; | 653 return; |
654 } | 654 } |
655 | 655 |
656 // Calculate the width and height of the content region in the |output|, based | 656 // Calculate the width and height of the content region in the |output|, based |
657 // on the aspect ratio of |input|. | 657 // on the aspect ratio of |input|. |
658 gfx::Rect region_in_frame = ComputeYV12LetterboxRegion( | 658 gfx::Rect region_in_frame = ComputeYV12LetterboxRegion( |
659 output->coded_size(), gfx::Size(input.width(), input.height())); | 659 output->coded_size(), gfx::Size(input.width(), input.height())); |
660 | 660 |
661 // Scale the bitmap to the required size, if necessary. | 661 // Scale the bitmap to the required size, if necessary. |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1269 void WebContentsVideoCaptureDevice::DeAllocate() { | 1269 void WebContentsVideoCaptureDevice::DeAllocate() { |
1270 impl_->DeAllocate(); | 1270 impl_->DeAllocate(); |
1271 } | 1271 } |
1272 | 1272 |
1273 const media::VideoCaptureDevice::Name& | 1273 const media::VideoCaptureDevice::Name& |
1274 WebContentsVideoCaptureDevice::device_name() { | 1274 WebContentsVideoCaptureDevice::device_name() { |
1275 return device_name_; | 1275 return device_name_; |
1276 } | 1276 } |
1277 | 1277 |
1278 } // namespace content | 1278 } // namespace content |
OLD | NEW |