| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // system_wrappers/include/aligned_malloc.h violate current DEPS | 182 // system_wrappers/include/aligned_malloc.h violate current DEPS |
| 183 // rules. We get away for now only because it is indirectly included | 183 // rules. We get away for now only because it is indirectly included |
| 184 // by i420_buffer.h | 184 // by i420_buffer.h |
| 185 std::unique_ptr<uint8_t, webrtc::AlignedFreeDeleter> yuv_data( | 185 std::unique_ptr<uint8_t, webrtc::AlignedFreeDeleter> yuv_data( |
| 186 static_cast<uint8_t*>(webrtc::AlignedMalloc(size, kBufferAlignment))); | 186 static_cast<uint8_t*>(webrtc::AlignedMalloc(size, kBufferAlignment))); |
| 187 // See YuvConverter.java for the required layout. | 187 // See YuvConverter.java for the required layout. |
| 188 uint8_t* y_data = yuv_data.get(); | 188 uint8_t* y_data = yuv_data.get(); |
| 189 uint8_t* u_data = y_data + height() * stride; | 189 uint8_t* u_data = y_data + height() * stride; |
| 190 uint8_t* v_data = u_data + stride/2; | 190 uint8_t* v_data = u_data + stride/2; |
| 191 | 191 |
| 192 rtc::scoped_refptr<webrtc::I420BufferInterface> copy = | 192 rtc::scoped_refptr<webrtc::I420BufferInterface> copy = webrtc::WrapI420Buffer( |
| 193 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( | 193 width(), height(), y_data, stride, u_data, stride, v_data, stride, |
| 194 width(), height(), y_data, stride, u_data, stride, v_data, stride, | 194 rtc::Bind(&webrtc::AlignedFree, yuv_data.release())); |
| 195 rtc::Bind(&webrtc::AlignedFree, yuv_data.release())); | |
| 196 | 195 |
| 197 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 196 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
| 198 ScopedLocalRefFrame local_ref_frame(jni); | 197 ScopedLocalRefFrame local_ref_frame(jni); |
| 199 | 198 |
| 200 jmethodID transform_mid = GetMethodID( | 199 jmethodID transform_mid = GetMethodID( |
| 201 jni, | 200 jni, |
| 202 GetObjectClass(jni, surface_texture_helper_), | 201 GetObjectClass(jni, surface_texture_helper_), |
| 203 "textureToYUV", | 202 "textureToYUV", |
| 204 "(Ljava/nio/ByteBuffer;IIII[F)V"); | 203 "(Ljava/nio/ByteBuffer;IIII[F)V"); |
| 205 | 204 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 int height, | 327 int height, |
| 329 const Matrix& matrix, | 328 const Matrix& matrix, |
| 330 jobject j_video_frame_buffer) const { | 329 jobject j_video_frame_buffer) const { |
| 331 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 330 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
| 332 return new rtc::RefCountedObject<AndroidVideoBuffer>( | 331 return new rtc::RefCountedObject<AndroidVideoBuffer>( |
| 333 jni, j_retain_id_, j_release_id_, width, height, matrix, | 332 jni, j_retain_id_, j_release_id_, width, height, matrix, |
| 334 j_video_frame_buffer); | 333 j_video_frame_buffer); |
| 335 } | 334 } |
| 336 | 335 |
| 337 } // namespace webrtc_jni | 336 } // namespace webrtc_jni |
| OLD | NEW |