OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 int rotated_width = crop_width; | 107 int rotated_width = crop_width; |
108 int rotated_height = crop_height; | 108 int rotated_height = crop_height; |
109 | 109 |
110 rtc::CritScope lock(&apply_rotation_crit_); | 110 rtc::CritScope lock(&apply_rotation_crit_); |
111 if (apply_rotation_ && (rotation == 90 || rotation == 270)) { | 111 if (apply_rotation_ && (rotation == 90 || rotation == 270)) { |
112 std::swap(adapted_width, adapted_height); | 112 std::swap(adapted_width, adapted_height); |
113 std::swap(rotated_width, rotated_height); | 113 std::swap(rotated_width, rotated_height); |
114 } | 114 } |
115 | 115 |
116 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer = | 116 rtc::scoped_refptr<webrtc::I420Buffer> buffer = |
117 pre_scale_pool_.CreateBuffer(rotated_width, rotated_height); | 117 pre_scale_pool_.CreateBuffer(rotated_width, rotated_height); |
118 | 118 |
119 const uint8_t* y_plane = static_cast<const uint8_t*>(frame_data); | 119 const uint8_t* y_plane = static_cast<const uint8_t*>(frame_data); |
120 const uint8_t* uv_plane = y_plane + width * height; | 120 const uint8_t* uv_plane = y_plane + width * height; |
121 int uv_width = (width + 1) / 2; | 121 int uv_width = (width + 1) / 2; |
122 | 122 |
123 RTC_CHECK_GE(length, width * height + 2 * uv_width * ((height + 1) / 2)); | 123 RTC_CHECK_GE(length, width * height + 2 * uv_width * ((height + 1) / 2)); |
124 | 124 |
125 // Can only crop at even pixels. | 125 // Can only crop at even pixels. |
126 crop_x &= ~1; | 126 crop_x &= ~1; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 251 } |
252 *crop_x = (width - *crop_width) / 2; | 252 *crop_x = (width - *crop_width) / 2; |
253 *crop_y = (height - *crop_height) / 2; | 253 *crop_y = (height - *crop_height) / 2; |
254 | 254 |
255 *translated_camera_time_us = timestamp_aligner_.ClipTimestamp( | 255 *translated_camera_time_us = timestamp_aligner_.ClipTimestamp( |
256 camera_time_us + offset_us, system_time_us); | 256 camera_time_us + offset_us, system_time_us); |
257 return true; | 257 return true; |
258 } | 258 } |
259 | 259 |
260 } // namespace webrtc | 260 } // namespace webrtc |
OLD | NEW |