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