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

Unified 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, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/examples/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/android/jni/peerconnection_jni.cc
diff --git a/webrtc/api/android/jni/peerconnection_jni.cc b/webrtc/api/android/jni/peerconnection_jni.cc
index a552e4c18ae970ecccf59b5acd0e98179ead6e23..3ca2fa3ee91e082e9fa9400a897da6127b4628ff 100644
--- a/webrtc/api/android/jni/peerconnection_jni.cc
+++ b/webrtc/api/android/jni/peerconnection_jni.cc
@@ -2014,10 +2014,12 @@ JOW(void, FileVideoCapturer_nativeI420ToNV21)(
int dst_stride = width;
RTC_CHECK_GE(src_size, src_stride * height * 3 / 2);
RTC_CHECK_GE(dst_size, dst_stride * height * 3 / 2);
- uint8_t* src =
- reinterpret_cast<uint8_t*>(jni->GetByteArrayElements(j_src_buffer, 0));
- uint8_t* dst =
- reinterpret_cast<uint8_t*>(jni->GetByteArrayElements(j_dst_buffer, 0));
+
+ jbyte* src_bytes = jni->GetByteArrayElements(j_src_buffer, 0);
+ uint8_t* src = reinterpret_cast<uint8_t*>(src_bytes);
+ jbyte* dst_bytes = jni->GetByteArrayElements(j_dst_buffer, 0);
+ uint8_t* dst = reinterpret_cast<uint8_t*>(dst_bytes);
+
uint8_t* src_y = src;
size_t src_stride_y = src_stride;
uint8_t* src_u = src + src_stride * height;
@@ -2030,9 +2032,14 @@ JOW(void, FileVideoCapturer_nativeI420ToNV21)(
size_t dst_stride_uv = dst_stride;
uint8_t* dst_uv = dst + dst_stride * height;
- libyuv::I420ToNV21(src_y, src_stride_y, src_u, src_stride_u, src_v,
- src_stride_v, dst_y, dst_stride_y, dst_uv, dst_stride_uv,
- width, height);
+ int ret = libyuv::I420ToNV21(src_y, src_stride_y, src_u, src_stride_u, src_v,
+ src_stride_v, dst_y, dst_stride_y, dst_uv,
+ dst_stride_uv, width, height);
+ jni->ReleaseByteArrayElements(j_src_buffer, src_bytes, 0);
+ jni->ReleaseByteArrayElements(j_dst_buffer, dst_bytes, 0);
+ if (ret) {
+ LOG(LS_ERROR) << "Error converting I420 frame to NV21: " << ret;
+ }
}
JOW(void, VideoFileRenderer_nativeI420Scale)(
« 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