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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 | 1069 |
1070 // Initialize capture settings which will be consistent for the | 1070 // Initialize capture settings which will be consistent for the |
1071 // duration of the capture. | 1071 // duration of the capture. |
1072 media::VideoCaptureCapability settings; | 1072 media::VideoCaptureCapability settings; |
1073 | 1073 |
1074 settings.width = width; | 1074 settings.width = width; |
1075 settings.height = height; | 1075 settings.height = height; |
1076 settings.frame_rate = frame_rate; | 1076 settings.frame_rate = frame_rate; |
1077 // Note: the value of |settings.color| doesn't matter if we use only the | 1077 // Note: the value of |settings.color| doesn't matter if we use only the |
1078 // VideoFrame based methods on |consumer|. | 1078 // VideoFrame based methods on |consumer|. |
1079 settings.color = media::VideoCaptureCapability::kI420; | 1079 settings.color = media::PIXEL_FORMAT_I420; |
1080 settings.expected_capture_delay = 0; | 1080 settings.expected_capture_delay = 0; |
1081 settings.interlaced = false; | 1081 settings.interlaced = false; |
1082 | 1082 |
1083 base::TimeDelta capture_period = base::TimeDelta::FromMicroseconds( | 1083 base::TimeDelta capture_period = base::TimeDelta::FromMicroseconds( |
1084 1000000.0 / settings.frame_rate + 0.5); | 1084 1000000.0 / settings.frame_rate + 0.5); |
1085 | 1085 |
1086 consumer_ = consumer; | 1086 consumer_ = consumer; |
1087 consumer_->OnFrameInfo(settings); | 1087 consumer_->OnFrameInfo(settings); |
1088 scoped_ptr<VideoCaptureOracle> oracle( | 1088 scoped_ptr<VideoCaptureOracle> oracle( |
1089 new VideoCaptureOracle(capture_period, | 1089 new VideoCaptureOracle(capture_period, |
(...skipping 179 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 |