OLD | NEW |
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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 // ownership of the frame, and the frame should be released with | 756 // ownership of the frame, and the frame should be released with |
757 // VideoRenderer.releaseNativeFrame(). | 757 // VideoRenderer.releaseNativeFrame(). |
758 static jlong javaShallowCopy(const cricket::VideoFrame* frame) { | 758 static jlong javaShallowCopy(const cricket::VideoFrame* frame) { |
759 return jlongFromPointer(frame->Copy()); | 759 return jlongFromPointer(frame->Copy()); |
760 } | 760 } |
761 | 761 |
762 // Return a VideoRenderer.I420Frame referring to the data in |frame|. | 762 // Return a VideoRenderer.I420Frame referring to the data in |frame|. |
763 jobject CricketToJavaI420Frame(const cricket::VideoFrame* frame) { | 763 jobject CricketToJavaI420Frame(const cricket::VideoFrame* frame) { |
764 jintArray strides = jni()->NewIntArray(3); | 764 jintArray strides = jni()->NewIntArray(3); |
765 jint* strides_array = jni()->GetIntArrayElements(strides, NULL); | 765 jint* strides_array = jni()->GetIntArrayElements(strides, NULL); |
766 strides_array[0] = frame->video_frame_buffer()->StrideY(); | 766 strides_array[0] = frame->GetYPitch(); |
767 strides_array[1] = frame->video_frame_buffer()->StrideU(); | 767 strides_array[1] = frame->GetUPitch(); |
768 strides_array[2] = frame->video_frame_buffer()->StrideV(); | 768 strides_array[2] = frame->GetVPitch(); |
769 jni()->ReleaseIntArrayElements(strides, strides_array, 0); | 769 jni()->ReleaseIntArrayElements(strides, strides_array, 0); |
770 jobjectArray planes = jni()->NewObjectArray(3, *j_byte_buffer_class_, NULL); | 770 jobjectArray planes = jni()->NewObjectArray(3, *j_byte_buffer_class_, NULL); |
771 jobject y_buffer = jni()->NewDirectByteBuffer( | 771 jobject y_buffer = |
772 const_cast<uint8_t*>(frame->video_frame_buffer()->DataY()), | 772 jni()->NewDirectByteBuffer(const_cast<uint8_t*>(frame->GetYPlane()), |
773 frame->video_frame_buffer()->StrideY() * | 773 frame->GetYPitch() * frame->GetHeight()); |
774 frame->video_frame_buffer()->height()); | |
775 size_t chroma_size = | 774 size_t chroma_size = |
776 ((frame->width() + 1) / 2) * ((frame->height() + 1) / 2); | 775 ((frame->width() + 1) / 2) * ((frame->height() + 1) / 2); |
777 jobject u_buffer = jni()->NewDirectByteBuffer( | 776 jobject u_buffer = jni()->NewDirectByteBuffer( |
778 const_cast<uint8_t*>(frame->video_frame_buffer()->DataU()), | 777 const_cast<uint8_t*>(frame->GetUPlane()), chroma_size); |
779 chroma_size); | |
780 jobject v_buffer = jni()->NewDirectByteBuffer( | 778 jobject v_buffer = jni()->NewDirectByteBuffer( |
781 const_cast<uint8_t*>(frame->video_frame_buffer()->DataV()), | 779 const_cast<uint8_t*>(frame->GetVPlane()), chroma_size); |
782 chroma_size); | |
783 jni()->SetObjectArrayElement(planes, 0, y_buffer); | 780 jni()->SetObjectArrayElement(planes, 0, y_buffer); |
784 jni()->SetObjectArrayElement(planes, 1, u_buffer); | 781 jni()->SetObjectArrayElement(planes, 1, u_buffer); |
785 jni()->SetObjectArrayElement(planes, 2, v_buffer); | 782 jni()->SetObjectArrayElement(planes, 2, v_buffer); |
786 return jni()->NewObject( | 783 return jni()->NewObject( |
787 *j_frame_class_, j_i420_frame_ctor_id_, | 784 *j_frame_class_, j_i420_frame_ctor_id_, |
788 frame->width(), frame->height(), | 785 frame->width(), frame->height(), |
789 static_cast<int>(frame->rotation()), | 786 static_cast<int>(frame->rotation()), |
790 strides, planes, javaShallowCopy(frame)); | 787 strides, planes, javaShallowCopy(frame)); |
791 } | 788 } |
792 | 789 |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 return JavaStringFromStdString( | 2148 return JavaStringFromStdString( |
2152 jni, | 2149 jni, |
2153 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2150 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2154 } | 2151 } |
2155 | 2152 |
2156 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2153 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2157 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2154 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2158 } | 2155 } |
2159 | 2156 |
2160 } // namespace webrtc_jni | 2157 } // namespace webrtc_jni |
OLD | NEW |