diff --git a/sdk/android/src/jni/nv12buffer.cc b/sdk/android/src/jni/nv12buffer.cc index 5f7edc85cf..23b1791ef9 100644 --- a/sdk/android/src/jni/nv12buffer.cc +++ b/sdk/android/src/jni/nv12buffer.cc @@ -62,7 +62,7 @@ static void JNI_NV12Buffer_CropAndScale(JNIEnv* jni, // Crop using pointer arithmetic. src_y += crop_x + crop_y * src_stride_y; - src_uv += crop_chroma_x + crop_chroma_y * src_stride_uv; + src_uv += 2 * crop_chroma_x + crop_chroma_y * src_stride_uv; std::vector tmp_buffer(tmp_size); uint8_t* tmp_u = tmp_buffer.data(); diff --git a/sdk/android/src/jni/nv21buffer.cc b/sdk/android/src/jni/nv21buffer.cc index c8a3a8b749..7f11488def 100644 --- a/sdk/android/src/jni/nv21buffer.cc +++ b/sdk/android/src/jni/nv21buffer.cc @@ -63,7 +63,7 @@ static void JNI_NV21Buffer_CropAndScale(JNIEnv* jni, // Crop using pointer arithmetic. src_y += crop_x + crop_y * src_stride_y; - src_uv += crop_chroma_x + crop_chroma_y * src_stride_uv; + src_uv += 2 * crop_chroma_x + crop_chroma_y * src_stride_uv; NV12ToI420Scaler scaler; // U- and V-planes are swapped because this is NV21 not NV12.