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