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 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 reinterpret_cast<MediaStreamInterface*>(native_stream)); | 1780 reinterpret_cast<MediaStreamInterface*>(native_stream)); |
1781 } | 1781 } |
1782 | 1782 |
1783 JOW(void, PeerConnection_nativeRemoveLocalStream)( | 1783 JOW(void, PeerConnection_nativeRemoveLocalStream)( |
1784 JNIEnv* jni, jobject j_pc, jlong native_stream) { | 1784 JNIEnv* jni, jobject j_pc, jlong native_stream) { |
1785 ExtractNativePC(jni, j_pc)->RemoveStream( | 1785 ExtractNativePC(jni, j_pc)->RemoveStream( |
1786 reinterpret_cast<MediaStreamInterface*>(native_stream)); | 1786 reinterpret_cast<MediaStreamInterface*>(native_stream)); |
1787 } | 1787 } |
1788 | 1788 |
1789 JOW(jobject, PeerConnection_nativeCreateSender)( | 1789 JOW(jobject, PeerConnection_nativeCreateSender)( |
1790 JNIEnv* jni, jobject j_pc, jstring j_kind) { | 1790 JNIEnv* jni, jobject j_pc, jstring j_kind, jstring j_stream_id) { |
1791 jclass j_rtp_sender_class = FindClass(jni, "org/webrtc/RtpSender"); | 1791 jclass j_rtp_sender_class = FindClass(jni, "org/webrtc/RtpSender"); |
1792 jmethodID j_rtp_sender_ctor = | 1792 jmethodID j_rtp_sender_ctor = |
1793 GetMethodID(jni, j_rtp_sender_class, "<init>", "(J)V"); | 1793 GetMethodID(jni, j_rtp_sender_class, "<init>", "(J)V"); |
1794 | 1794 |
1795 std::string kind = JavaToStdString(jni, j_kind); | 1795 std::string kind = JavaToStdString(jni, j_kind); |
| 1796 std::string stream_id = JavaToStdString(jni, j_stream_id); |
1796 rtc::scoped_refptr<RtpSenderInterface> sender = | 1797 rtc::scoped_refptr<RtpSenderInterface> sender = |
1797 ExtractNativePC(jni, j_pc)->CreateSender(kind); | 1798 ExtractNativePC(jni, j_pc)->CreateSender(kind, stream_id); |
1798 if (!sender.get()) { | 1799 if (!sender.get()) { |
1799 return nullptr; | 1800 return nullptr; |
1800 } | 1801 } |
1801 jlong nativeSenderPtr = jlongFromPointer(sender.get()); | 1802 jlong nativeSenderPtr = jlongFromPointer(sender.get()); |
1802 jobject j_sender = | 1803 jobject j_sender = |
1803 jni->NewObject(j_rtp_sender_class, j_rtp_sender_ctor, nativeSenderPtr); | 1804 jni->NewObject(j_rtp_sender_class, j_rtp_sender_ctor, nativeSenderPtr); |
1804 CHECK_EXCEPTION(jni) << "error during NewObject"; | 1805 CHECK_EXCEPTION(jni) << "error during NewObject"; |
1805 // Sender is now owned by the Java object, and will be freed from | 1806 // Sender is now owned by the Java object, and will be freed from |
1806 // RtpSender.dispose(), called by PeerConnection.dispose() or getSenders(). | 1807 // RtpSender.dispose(), called by PeerConnection.dispose() or getSenders(). |
1807 sender->AddRef(); | 1808 sender->AddRef(); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 return JavaStringFromStdString( | 2158 return JavaStringFromStdString( |
2158 jni, | 2159 jni, |
2159 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2160 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2160 } | 2161 } |
2161 | 2162 |
2162 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2163 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2163 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2164 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2164 } | 2165 } |
2165 | 2166 |
2166 } // namespace webrtc_jni | 2167 } // namespace webrtc_jni |
OLD | NEW |