| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 return CaptureCustomFrame(width, height, 33333333, fourcc); | 72 return CaptureCustomFrame(width, height, 33333333, fourcc); |
| 73 } | 73 } |
| 74 bool CaptureCustomFrame(int width, | 74 bool CaptureCustomFrame(int width, |
| 75 int height, | 75 int height, |
| 76 int64_t timestamp_interval, | 76 int64_t timestamp_interval, |
| 77 uint32_t fourcc) { | 77 uint32_t fourcc) { |
| 78 if (!running_) { | 78 if (!running_) { |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 // Currently, |fourcc| is always I420 or ARGB. | 81 // Currently, |fourcc| is always I420 or ARGB. |
| 82 // TODO(fbarchard): Extend SizeOf to take fourcc. | |
| 83 uint32_t size = 0u; | 82 uint32_t size = 0u; |
| 84 if (fourcc == cricket::FOURCC_ARGB) { | 83 if (fourcc == cricket::FOURCC_ARGB) { |
| 85 size = width * 4 * height; | 84 size = width * 4 * height; |
| 86 } else if (fourcc == cricket::FOURCC_I420) { | 85 } else if (fourcc == cricket::FOURCC_I420) { |
| 87 size = static_cast<uint32_t>(cricket::VideoFrame::SizeOf(width, height)); | 86 size = width * height + 2 * ((width + 1) / 2) * ((height + 1) / 2); |
| 88 } else { | 87 } else { |
| 89 return false; // Unsupported FOURCC. | 88 return false; // Unsupported FOURCC. |
| 90 } | 89 } |
| 91 if (size == 0u) { | 90 if (size == 0u) { |
| 92 return false; // Width and/or Height were zero. | 91 return false; // Width and/or Height were zero. |
| 93 } | 92 } |
| 94 | 93 |
| 95 cricket::CapturedFrame frame; | 94 cricket::CapturedFrame frame; |
| 96 frame.width = width; | 95 frame.width = width; |
| 97 frame.height = height; | 96 frame.height = height; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 bool running_; | 155 bool running_; |
| 157 int64_t initial_unix_timestamp_; | 156 int64_t initial_unix_timestamp_; |
| 158 int64_t next_timestamp_; | 157 int64_t next_timestamp_; |
| 159 bool is_screencast_; | 158 bool is_screencast_; |
| 160 webrtc::VideoRotation rotation_; | 159 webrtc::VideoRotation rotation_; |
| 161 }; | 160 }; |
| 162 | 161 |
| 163 } // namespace cricket | 162 } // namespace cricket |
| 164 | 163 |
| 165 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ | 164 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ |
| OLD | NEW |