| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 const uint8_t* uv_plane = y_plane + width * height; | 208 const uint8_t* uv_plane = y_plane + width * height; |
| 209 | 209 |
| 210 // Can only crop at even pixels. | 210 // Can only crop at even pixels. |
| 211 crop_x &= ~1; | 211 crop_x &= ~1; |
| 212 crop_y &= ~1; | 212 crop_y &= ~1; |
| 213 int uv_width = (width + 1) / 2; | 213 int uv_width = (width + 1) / 2; |
| 214 | 214 |
| 215 libyuv::NV12ToI420Rotate( | 215 libyuv::NV12ToI420Rotate( |
| 216 y_plane + width * crop_y + crop_x, width, | 216 y_plane + width * crop_y + crop_x, width, |
| 217 uv_plane + uv_width * crop_y + crop_x, width, | 217 uv_plane + uv_width * crop_y + crop_x, width, |
| 218 buffer->MutableData(webrtc::kYPlane), buffer->stride(webrtc::kYPlane), | 218 buffer->MutableDataY(), buffer->StrideY(), |
| 219 // Swap U and V, since we have NV21, not NV12. | 219 // Swap U and V, since we have NV21, not NV12. |
| 220 buffer->MutableData(webrtc::kVPlane), buffer->stride(webrtc::kVPlane), | 220 buffer->MutableDataV(), buffer->StrideV(), |
| 221 buffer->MutableData(webrtc::kUPlane), buffer->stride(webrtc::kUPlane), | 221 buffer->MutableDataU(), buffer->StrideU(), |
| 222 crop_width, crop_height, static_cast<libyuv::RotationMode>( | 222 crop_width, crop_height, static_cast<libyuv::RotationMode>( |
| 223 capturer_->apply_rotation() ? rotation : 0)); | 223 capturer_->apply_rotation() ? rotation : 0)); |
| 224 | 224 |
| 225 if (adapted_width != buffer->width() || adapted_height != buffer->height()) { | 225 if (adapted_width != buffer->width() || adapted_height != buffer->height()) { |
| 226 rtc::scoped_refptr<webrtc::I420Buffer> scaled_buffer( | 226 rtc::scoped_refptr<webrtc::I420Buffer> scaled_buffer( |
| 227 post_scale_pool_.CreateBuffer(adapted_width, adapted_height)); | 227 post_scale_pool_.CreateBuffer(adapted_width, adapted_height)); |
| 228 scaled_buffer->ScaleFrom(buffer); | 228 scaled_buffer->ScaleFrom(buffer); |
| 229 buffer = scaled_buffer; | 229 buffer = scaled_buffer; |
| 230 } | 230 } |
| 231 // TODO(nisse): Use microsecond time instead. | 231 // TODO(nisse): Use microsecond time instead. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 | 331 |
| 332 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest) | 332 JOW(void, VideoCapturer_00024NativeObserver_nativeOnOutputFormatRequest) |
| 333 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, | 333 (JNIEnv* jni, jclass, jlong j_capturer, jint j_width, jint j_height, |
| 334 jint j_fps) { | 334 jint j_fps) { |
| 335 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; | 335 LOG(LS_INFO) << "NativeObserver_nativeOnOutputFormatRequest"; |
| 336 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( | 336 reinterpret_cast<AndroidVideoCapturerJni*>(j_capturer)->OnOutputFormatRequest( |
| 337 j_width, j_height, j_fps); | 337 j_width, j_height, j_fps); |
| 338 } | 338 } |
| 339 | 339 |
| 340 } // namespace webrtc_jni | 340 } // namespace webrtc_jni |
| OLD | NEW |