Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: webrtc/api/android/jni/peerconnection_jni.cc

Issue 2405463002: Testing of FileVideoCapturer (Closed)
Patch Set: Merge branch 'master' into with_yuv_file_reader Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/examples/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2013 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 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 2007
2008 JOW(void, FileVideoCapturer_nativeI420ToNV21)( 2008 JOW(void, FileVideoCapturer_nativeI420ToNV21)(
2009 JNIEnv *jni, jclass, jbyteArray j_src_buffer, jint width, jint height, 2009 JNIEnv *jni, jclass, jbyteArray j_src_buffer, jint width, jint height,
2010 jbyteArray j_dst_buffer) { 2010 jbyteArray j_dst_buffer) {
2011 size_t src_size = jni->GetArrayLength(j_src_buffer); 2011 size_t src_size = jni->GetArrayLength(j_src_buffer);
2012 size_t dst_size = jni->GetArrayLength(j_dst_buffer); 2012 size_t dst_size = jni->GetArrayLength(j_dst_buffer);
2013 int src_stride = width; 2013 int src_stride = width;
2014 int dst_stride = width; 2014 int dst_stride = width;
2015 RTC_CHECK_GE(src_size, src_stride * height * 3 / 2); 2015 RTC_CHECK_GE(src_size, src_stride * height * 3 / 2);
2016 RTC_CHECK_GE(dst_size, dst_stride * height * 3 / 2); 2016 RTC_CHECK_GE(dst_size, dst_stride * height * 3 / 2);
2017 uint8_t* src = 2017
2018 reinterpret_cast<uint8_t*>(jni->GetByteArrayElements(j_src_buffer, 0)); 2018 jbyte* src_bytes = jni->GetByteArrayElements(j_src_buffer, 0);
2019 uint8_t* dst = 2019 uint8_t* src = reinterpret_cast<uint8_t*>(src_bytes);
2020 reinterpret_cast<uint8_t*>(jni->GetByteArrayElements(j_dst_buffer, 0)); 2020 jbyte* dst_bytes = jni->GetByteArrayElements(j_dst_buffer, 0);
2021 uint8_t* dst = reinterpret_cast<uint8_t*>(dst_bytes);
2022
2021 uint8_t* src_y = src; 2023 uint8_t* src_y = src;
2022 size_t src_stride_y = src_stride; 2024 size_t src_stride_y = src_stride;
2023 uint8_t* src_u = src + src_stride * height; 2025 uint8_t* src_u = src + src_stride * height;
2024 size_t src_stride_u = src_stride / 2; 2026 size_t src_stride_u = src_stride / 2;
2025 uint8_t* src_v = src + src_stride * height * 5 / 4; 2027 uint8_t* src_v = src + src_stride * height * 5 / 4;
2026 size_t src_stride_v = src_stride / 2; 2028 size_t src_stride_v = src_stride / 2;
2027 2029
2028 uint8_t* dst_y = dst; 2030 uint8_t* dst_y = dst;
2029 size_t dst_stride_y = dst_stride; 2031 size_t dst_stride_y = dst_stride;
2030 size_t dst_stride_uv = dst_stride; 2032 size_t dst_stride_uv = dst_stride;
2031 uint8_t* dst_uv = dst + dst_stride * height; 2033 uint8_t* dst_uv = dst + dst_stride * height;
2032 2034
2033 libyuv::I420ToNV21(src_y, src_stride_y, src_u, src_stride_u, src_v, 2035 int ret = libyuv::I420ToNV21(src_y, src_stride_y, src_u, src_stride_u, src_v,
2034 src_stride_v, dst_y, dst_stride_y, dst_uv, dst_stride_uv, 2036 src_stride_v, dst_y, dst_stride_y, dst_uv,
2035 width, height); 2037 dst_stride_uv, width, height);
2038 jni->ReleaseByteArrayElements(j_src_buffer, src_bytes, 0);
2039 jni->ReleaseByteArrayElements(j_dst_buffer, dst_bytes, 0);
2040 if (ret) {
2041 LOG(LS_ERROR) << "Error converting I420 frame to NV21: " << ret;
2042 }
2036 } 2043 }
2037 2044
2038 JOW(void, VideoFileRenderer_nativeI420Scale)( 2045 JOW(void, VideoFileRenderer_nativeI420Scale)(
2039 JNIEnv *jni, jclass, 2046 JNIEnv *jni, jclass,
2040 jobject j_src_buffer_y, jint j_src_stride_y, 2047 jobject j_src_buffer_y, jint j_src_stride_y,
2041 jobject j_src_buffer_u, jint j_src_stride_u, 2048 jobject j_src_buffer_u, jint j_src_stride_u,
2042 jobject j_src_buffer_v, jint j_src_stride_v, 2049 jobject j_src_buffer_v, jint j_src_stride_v,
2043 jint width, jint height, 2050 jint width, jint height,
2044 jbyteArray j_dst_buffer, jint dstWidth, jint dstHeight) { 2051 jbyteArray j_dst_buffer, jint dstWidth, jint dstHeight) {
2045 size_t src_size_y = jni->GetDirectBufferCapacity(j_src_buffer_y); 2052 size_t src_size_y = jni->GetDirectBufferCapacity(j_src_buffer_y);
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 return JavaStringFromStdString( 2399 return JavaStringFromStdString(
2393 jni, 2400 jni,
2394 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); 2401 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id());
2395 } 2402 }
2396 2403
2397 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { 2404 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) {
2398 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); 2405 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release();
2399 } 2406 }
2400 2407
2401 } // namespace webrtc_jni 2408 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « no previous file | webrtc/examples/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698