OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 jni, *j_observer_class_, "onBufferedAmountChange", "(J)V")), | 599 jni, *j_observer_class_, "onBufferedAmountChange", "(J)V")), |
600 j_on_state_change_mid_( | 600 j_on_state_change_mid_( |
601 GetMethodID(jni, *j_observer_class_, "onStateChange", "()V")), | 601 GetMethodID(jni, *j_observer_class_, "onStateChange", "()V")), |
602 j_on_message_mid_(GetMethodID(jni, *j_observer_class_, "onMessage", | 602 j_on_message_mid_(GetMethodID(jni, *j_observer_class_, "onMessage", |
603 "(Lorg/webrtc/DataChannel$Buffer;)V")), | 603 "(Lorg/webrtc/DataChannel$Buffer;)V")), |
604 j_buffer_ctor_(GetMethodID(jni, *j_buffer_class_, "<init>", | 604 j_buffer_ctor_(GetMethodID(jni, *j_buffer_class_, "<init>", |
605 "(Ljava/nio/ByteBuffer;Z)V")) {} | 605 "(Ljava/nio/ByteBuffer;Z)V")) {} |
606 | 606 |
607 virtual ~DataChannelObserverWrapper() {} | 607 virtual ~DataChannelObserverWrapper() {} |
608 | 608 |
609 void OnBufferedAmountChange(uint64 previous_amount) override { | 609 void OnBufferedAmountChange(uint64_t previous_amount) override { |
610 ScopedLocalRefFrame local_ref_frame(jni()); | 610 ScopedLocalRefFrame local_ref_frame(jni()); |
611 jni()->CallVoidMethod(*j_observer_global_, j_on_buffered_amount_change_mid_, | 611 jni()->CallVoidMethod(*j_observer_global_, j_on_buffered_amount_change_mid_, |
612 previous_amount); | 612 previous_amount); |
613 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod"; | 613 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod"; |
614 } | 614 } |
615 | 615 |
616 void OnStateChange() override { | 616 void OnStateChange() override { |
617 ScopedLocalRefFrame local_ref_frame(jni()); | 617 ScopedLocalRefFrame local_ref_frame(jni()); |
618 jni()->CallVoidMethod(*j_observer_global_, j_on_state_change_mid_); | 618 jni()->CallVoidMethod(*j_observer_global_, j_on_state_change_mid_); |
619 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod"; | 619 CHECK_EXCEPTION(jni()) << "error during CallVoidMethod"; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 799 |
800 // Return a VideoRenderer.I420Frame referring to the data in |frame|. | 800 // Return a VideoRenderer.I420Frame referring to the data in |frame|. |
801 jobject CricketToJavaI420Frame(const cricket::VideoFrame* frame) { | 801 jobject CricketToJavaI420Frame(const cricket::VideoFrame* frame) { |
802 jintArray strides = jni()->NewIntArray(3); | 802 jintArray strides = jni()->NewIntArray(3); |
803 jint* strides_array = jni()->GetIntArrayElements(strides, NULL); | 803 jint* strides_array = jni()->GetIntArrayElements(strides, NULL); |
804 strides_array[0] = frame->GetYPitch(); | 804 strides_array[0] = frame->GetYPitch(); |
805 strides_array[1] = frame->GetUPitch(); | 805 strides_array[1] = frame->GetUPitch(); |
806 strides_array[2] = frame->GetVPitch(); | 806 strides_array[2] = frame->GetVPitch(); |
807 jni()->ReleaseIntArrayElements(strides, strides_array, 0); | 807 jni()->ReleaseIntArrayElements(strides, strides_array, 0); |
808 jobjectArray planes = jni()->NewObjectArray(3, *j_byte_buffer_class_, NULL); | 808 jobjectArray planes = jni()->NewObjectArray(3, *j_byte_buffer_class_, NULL); |
809 jobject y_buffer = jni()->NewDirectByteBuffer( | 809 jobject y_buffer = |
810 const_cast<uint8*>(frame->GetYPlane()), | 810 jni()->NewDirectByteBuffer(const_cast<uint8_t*>(frame->GetYPlane()), |
811 frame->GetYPitch() * frame->GetHeight()); | 811 frame->GetYPitch() * frame->GetHeight()); |
812 jobject u_buffer = jni()->NewDirectByteBuffer( | 812 jobject u_buffer = jni()->NewDirectByteBuffer( |
813 const_cast<uint8*>(frame->GetUPlane()), frame->GetChromaSize()); | 813 const_cast<uint8_t*>(frame->GetUPlane()), frame->GetChromaSize()); |
814 jobject v_buffer = jni()->NewDirectByteBuffer( | 814 jobject v_buffer = jni()->NewDirectByteBuffer( |
815 const_cast<uint8*>(frame->GetVPlane()), frame->GetChromaSize()); | 815 const_cast<uint8_t*>(frame->GetVPlane()), frame->GetChromaSize()); |
816 jni()->SetObjectArrayElement(planes, 0, y_buffer); | 816 jni()->SetObjectArrayElement(planes, 0, y_buffer); |
817 jni()->SetObjectArrayElement(planes, 1, u_buffer); | 817 jni()->SetObjectArrayElement(planes, 1, u_buffer); |
818 jni()->SetObjectArrayElement(planes, 2, v_buffer); | 818 jni()->SetObjectArrayElement(planes, 2, v_buffer); |
819 return jni()->NewObject( | 819 return jni()->NewObject( |
820 *j_frame_class_, j_i420_frame_ctor_id_, | 820 *j_frame_class_, j_i420_frame_ctor_id_, |
821 frame->GetWidth(), frame->GetHeight(), | 821 frame->GetWidth(), frame->GetHeight(), |
822 static_cast<int>(frame->GetVideoRotation()), | 822 static_cast<int>(frame->GetVideoRotation()), |
823 strides, planes, javaShallowCopy(frame)); | 823 strides, planes, javaShallowCopy(frame)); |
824 } | 824 } |
825 | 825 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 JOW(jstring, DataChannel_label)(JNIEnv* jni, jobject j_dc) { | 873 JOW(jstring, DataChannel_label)(JNIEnv* jni, jobject j_dc) { |
874 return JavaStringFromStdString(jni, ExtractNativeDC(jni, j_dc)->label()); | 874 return JavaStringFromStdString(jni, ExtractNativeDC(jni, j_dc)->label()); |
875 } | 875 } |
876 | 876 |
877 JOW(jobject, DataChannel_state)(JNIEnv* jni, jobject j_dc) { | 877 JOW(jobject, DataChannel_state)(JNIEnv* jni, jobject j_dc) { |
878 return JavaEnumFromIndex( | 878 return JavaEnumFromIndex( |
879 jni, "DataChannel$State", ExtractNativeDC(jni, j_dc)->state()); | 879 jni, "DataChannel$State", ExtractNativeDC(jni, j_dc)->state()); |
880 } | 880 } |
881 | 881 |
882 JOW(jlong, DataChannel_bufferedAmount)(JNIEnv* jni, jobject j_dc) { | 882 JOW(jlong, DataChannel_bufferedAmount)(JNIEnv* jni, jobject j_dc) { |
883 uint64 buffered_amount = ExtractNativeDC(jni, j_dc)->buffered_amount(); | 883 uint64_t buffered_amount = ExtractNativeDC(jni, j_dc)->buffered_amount(); |
884 RTC_CHECK_LE(buffered_amount, std::numeric_limits<int64>::max()) | 884 RTC_CHECK_LE(buffered_amount, std::numeric_limits<int64_t>::max()) |
885 << "buffered_amount overflowed jlong!"; | 885 << "buffered_amount overflowed jlong!"; |
886 return static_cast<jlong>(buffered_amount); | 886 return static_cast<jlong>(buffered_amount); |
887 } | 887 } |
888 | 888 |
889 JOW(void, DataChannel_close)(JNIEnv* jni, jobject j_dc) { | 889 JOW(void, DataChannel_close)(JNIEnv* jni, jobject j_dc) { |
890 ExtractNativeDC(jni, j_dc)->Close(); | 890 ExtractNativeDC(jni, j_dc)->Close(); |
891 } | 891 } |
892 | 892 |
893 JOW(jboolean, DataChannel_sendNative)(JNIEnv* jni, jobject j_dc, | 893 JOW(jboolean, DataChannel_sendNative)(JNIEnv* jni, jobject j_dc, |
894 jbyteArray data, jboolean binary) { | 894 jbyteArray data, jboolean binary) { |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 return JavaStringFromStdString( | 1972 return JavaStringFromStdString( |
1973 jni, | 1973 jni, |
1974 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 1974 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
1975 } | 1975 } |
1976 | 1976 |
1977 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 1977 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
1978 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 1978 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
1979 } | 1979 } |
1980 | 1980 |
1981 } // namespace webrtc_jni | 1981 } // namespace webrtc_jni |
OLD | NEW |