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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 // VideoRenderer.renderFrameDone(). | 763 // VideoRenderer.renderFrameDone(). |
764 jni()->CallVoidMethod(*j_callbacks_, j_render_frame_id_, j_frame); | 764 jni()->CallVoidMethod(*j_callbacks_, j_render_frame_id_, j_frame); |
765 CHECK_EXCEPTION(jni()); | 765 CHECK_EXCEPTION(jni()); |
766 } | 766 } |
767 | 767 |
768 private: | 768 private: |
769 // Make a shallow copy of |frame| to be used with Java. The callee has | 769 // Make a shallow copy of |frame| to be used with Java. The callee has |
770 // ownership of the frame, and the frame should be released with | 770 // ownership of the frame, and the frame should be released with |
771 // VideoRenderer.releaseNativeFrame(). | 771 // VideoRenderer.releaseNativeFrame(). |
772 static jlong javaShallowCopy(const cricket::VideoFrame* frame) { | 772 static jlong javaShallowCopy(const cricket::VideoFrame* frame) { |
773 return jlongFromPointer(new cricket::WebRtcVideoFrame( | 773 return jlongFromPointer(frame->Copy()); |
774 frame->video_frame_buffer(), frame->rotation(), frame->timestamp_us())); | |
775 } | 774 } |
776 | 775 |
777 // Return a VideoRenderer.I420Frame referring to the data in |frame|. | 776 // Return a VideoRenderer.I420Frame referring to the data in |frame|. |
778 jobject CricketToJavaI420Frame(const cricket::VideoFrame* frame) { | 777 jobject CricketToJavaI420Frame(const cricket::VideoFrame* frame) { |
779 jintArray strides = jni()->NewIntArray(3); | 778 jintArray strides = jni()->NewIntArray(3); |
780 jint* strides_array = jni()->GetIntArrayElements(strides, NULL); | 779 jint* strides_array = jni()->GetIntArrayElements(strides, NULL); |
781 strides_array[0] = frame->video_frame_buffer()->StrideY(); | 780 strides_array[0] = frame->video_frame_buffer()->StrideY(); |
782 strides_array[1] = frame->video_frame_buffer()->StrideU(); | 781 strides_array[1] = frame->video_frame_buffer()->StrideU(); |
783 strides_array[2] = frame->video_frame_buffer()->StrideV(); | 782 strides_array[2] = frame->video_frame_buffer()->StrideV(); |
784 jni()->ReleaseIntArrayElements(strides, strides_array, 0); | 783 jni()->ReleaseIntArrayElements(strides, strides_array, 0); |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2349 return JavaStringFromStdString( | 2348 return JavaStringFromStdString( |
2350 jni, | 2349 jni, |
2351 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2350 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2352 } | 2351 } |
2353 | 2352 |
2354 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2353 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2355 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2354 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2356 } | 2355 } |
2357 | 2356 |
2358 } // namespace webrtc_jni | 2357 } // namespace webrtc_jni |
OLD | NEW |