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->GetYPitch(); | 766 strides_array[0] = frame->video_frame_buffer()->StrideY(); |
767 strides_array[1] = frame->GetUPitch(); | 767 strides_array[1] = frame->video_frame_buffer()->StrideU(); |
768 strides_array[2] = frame->GetVPitch(); | 768 strides_array[2] = frame->video_frame_buffer()->StrideV(); |
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 = | 771 jobject y_buffer = jni()->NewDirectByteBuffer( |
772 jni()->NewDirectByteBuffer(const_cast<uint8_t*>(frame->GetYPlane()), | 772 const_cast<uint8_t*>(frame->video_frame_buffer()->DataY()), |
773 frame->GetYPitch() * frame->GetHeight()); | 773 frame->video_frame_buffer()->StrideY() * |
| 774 frame->video_frame_buffer()->height()); |
774 size_t chroma_size = | 775 size_t chroma_size = |
775 ((frame->width() + 1) / 2) * ((frame->height() + 1) / 2); | 776 ((frame->width() + 1) / 2) * ((frame->height() + 1) / 2); |
776 jobject u_buffer = jni()->NewDirectByteBuffer( | 777 jobject u_buffer = jni()->NewDirectByteBuffer( |
777 const_cast<uint8_t*>(frame->GetUPlane()), chroma_size); | 778 const_cast<uint8_t*>(frame->video_frame_buffer()->DataU()), |
| 779 chroma_size); |
778 jobject v_buffer = jni()->NewDirectByteBuffer( | 780 jobject v_buffer = jni()->NewDirectByteBuffer( |
779 const_cast<uint8_t*>(frame->GetVPlane()), chroma_size); | 781 const_cast<uint8_t*>(frame->video_frame_buffer()->DataV()), |
| 782 chroma_size); |
780 jni()->SetObjectArrayElement(planes, 0, y_buffer); | 783 jni()->SetObjectArrayElement(planes, 0, y_buffer); |
781 jni()->SetObjectArrayElement(planes, 1, u_buffer); | 784 jni()->SetObjectArrayElement(planes, 1, u_buffer); |
782 jni()->SetObjectArrayElement(planes, 2, v_buffer); | 785 jni()->SetObjectArrayElement(planes, 2, v_buffer); |
783 return jni()->NewObject( | 786 return jni()->NewObject( |
784 *j_frame_class_, j_i420_frame_ctor_id_, | 787 *j_frame_class_, j_i420_frame_ctor_id_, |
785 frame->width(), frame->height(), | 788 frame->width(), frame->height(), |
786 static_cast<int>(frame->rotation()), | 789 static_cast<int>(frame->rotation()), |
787 strides, planes, javaShallowCopy(frame)); | 790 strides, planes, javaShallowCopy(frame)); |
788 } | 791 } |
789 | 792 |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2148 return JavaStringFromStdString( | 2151 return JavaStringFromStdString( |
2149 jni, | 2152 jni, |
2150 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2153 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2151 } | 2154 } |
2152 | 2155 |
2153 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2156 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2154 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2157 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2155 } | 2158 } |
2156 | 2159 |
2157 } // namespace webrtc_jni | 2160 } // namespace webrtc_jni |
OLD | NEW |