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 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 rtc::KeyParams(key_type), rtc::Optional<uint64_t>()); | 1778 rtc::KeyParams(key_type), rtc::Optional<uint64_t>()); |
1779 if (!certificate) { | 1779 if (!certificate) { |
1780 LOG(LS_ERROR) << "Failed to generate certificate. KeyType: " << key_type; | 1780 LOG(LS_ERROR) << "Failed to generate certificate. KeyType: " << key_type; |
1781 return 0; | 1781 return 0; |
1782 } | 1782 } |
1783 rtc_config.certificates.push_back(certificate); | 1783 rtc_config.certificates.push_back(certificate); |
1784 } | 1784 } |
1785 | 1785 |
1786 PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p); | 1786 PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p); |
1787 observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints)); | 1787 observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints)); |
1788 rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection( | 1788 CopyConstraintsIntoRtcConfiguration(observer->constraints(), &rtc_config); |
1789 rtc_config, observer->constraints(), NULL, NULL, observer)); | 1789 rtc::scoped_refptr<PeerConnectionInterface> pc( |
| 1790 f->CreatePeerConnection(rtc_config, nullptr, nullptr, observer)); |
1790 return (jlong)pc.release(); | 1791 return (jlong)pc.release(); |
1791 } | 1792 } |
1792 | 1793 |
1793 static rtc::scoped_refptr<PeerConnectionInterface> ExtractNativePC( | 1794 static rtc::scoped_refptr<PeerConnectionInterface> ExtractNativePC( |
1794 JNIEnv* jni, jobject j_pc) { | 1795 JNIEnv* jni, jobject j_pc) { |
1795 jfieldID native_pc_id = GetFieldID(jni, | 1796 jfieldID native_pc_id = GetFieldID(jni, |
1796 GetObjectClass(jni, j_pc), "nativePeerConnection", "J"); | 1797 GetObjectClass(jni, j_pc), "nativePeerConnection", "J"); |
1797 jlong j_p = GetLongField(jni, j_pc, native_pc_id); | 1798 jlong j_p = GetLongField(jni, j_pc, native_pc_id); |
1798 return rtc::scoped_refptr<PeerConnectionInterface>( | 1799 return rtc::scoped_refptr<PeerConnectionInterface>( |
1799 reinterpret_cast<PeerConnectionInterface*>(j_p)); | 1800 reinterpret_cast<PeerConnectionInterface*>(j_p)); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 JOW(void, PeerConnection_setRemoteDescription)( | 1895 JOW(void, PeerConnection_setRemoteDescription)( |
1895 JNIEnv* jni, jobject j_pc, | 1896 JNIEnv* jni, jobject j_pc, |
1896 jobject j_observer, jobject j_sdp) { | 1897 jobject j_observer, jobject j_sdp) { |
1897 rtc::scoped_refptr<SetSdpObserverWrapper> observer( | 1898 rtc::scoped_refptr<SetSdpObserverWrapper> observer( |
1898 new rtc::RefCountedObject<SetSdpObserverWrapper>( | 1899 new rtc::RefCountedObject<SetSdpObserverWrapper>( |
1899 jni, j_observer, reinterpret_cast<ConstraintsWrapper*>(NULL))); | 1900 jni, j_observer, reinterpret_cast<ConstraintsWrapper*>(NULL))); |
1900 ExtractNativePC(jni, j_pc)->SetRemoteDescription( | 1901 ExtractNativePC(jni, j_pc)->SetRemoteDescription( |
1901 observer, JavaSdpToNativeSdp(jni, j_sdp)); | 1902 observer, JavaSdpToNativeSdp(jni, j_sdp)); |
1902 } | 1903 } |
1903 | 1904 |
1904 JOW(jboolean, PeerConnection_setConfiguration)( | 1905 JOW(jboolean, PeerConnection_nativeSetConfiguration)( |
1905 JNIEnv* jni, jobject j_pc, jobject j_rtc_config) { | 1906 JNIEnv* jni, jobject j_pc, jobject j_rtc_config, jlong native_observer) { |
| 1907 // Need to merge constraints into RTCConfiguration again, which are stored |
| 1908 // in the observer object. |
| 1909 PCOJava* observer = reinterpret_cast<PCOJava*>(native_observer); |
1906 PeerConnectionInterface::RTCConfiguration rtc_config( | 1910 PeerConnectionInterface::RTCConfiguration rtc_config( |
1907 PeerConnectionInterface::RTCConfigurationType::kAggressive); | 1911 PeerConnectionInterface::RTCConfigurationType::kAggressive); |
1908 JavaRTCConfigurationToJsepRTCConfiguration(jni, j_rtc_config, &rtc_config); | 1912 JavaRTCConfigurationToJsepRTCConfiguration(jni, j_rtc_config, &rtc_config); |
| 1913 CopyConstraintsIntoRtcConfiguration(observer->constraints(), &rtc_config); |
1909 return ExtractNativePC(jni, j_pc)->SetConfiguration(rtc_config); | 1914 return ExtractNativePC(jni, j_pc)->SetConfiguration(rtc_config); |
1910 } | 1915 } |
1911 | 1916 |
1912 JOW(jboolean, PeerConnection_nativeAddIceCandidate)( | 1917 JOW(jboolean, PeerConnection_nativeAddIceCandidate)( |
1913 JNIEnv* jni, jobject j_pc, jstring j_sdp_mid, | 1918 JNIEnv* jni, jobject j_pc, jstring j_sdp_mid, |
1914 jint j_sdp_mline_index, jstring j_candidate_sdp) { | 1919 jint j_sdp_mline_index, jstring j_candidate_sdp) { |
1915 std::string sdp_mid = JavaToStdString(jni, j_sdp_mid); | 1920 std::string sdp_mid = JavaToStdString(jni, j_sdp_mid); |
1916 std::string sdp = JavaToStdString(jni, j_candidate_sdp); | 1921 std::string sdp = JavaToStdString(jni, j_candidate_sdp); |
1917 std::unique_ptr<IceCandidateInterface> candidate( | 1922 std::unique_ptr<IceCandidateInterface> candidate( |
1918 webrtc::CreateIceCandidate(sdp_mid, j_sdp_mline_index, sdp, NULL)); | 1923 webrtc::CreateIceCandidate(sdp_mid, j_sdp_mline_index, sdp, NULL)); |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2535 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer) | 2540 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer) |
2536 ->SetObserver(nullptr); | 2541 ->SetObserver(nullptr); |
2537 RtpReceiverObserver* observer = | 2542 RtpReceiverObserver* observer = |
2538 reinterpret_cast<RtpReceiverObserver*>(j_observer_pointer); | 2543 reinterpret_cast<RtpReceiverObserver*>(j_observer_pointer); |
2539 if (observer) { | 2544 if (observer) { |
2540 delete observer; | 2545 delete observer; |
2541 } | 2546 } |
2542 } | 2547 } |
2543 | 2548 |
2544 } // namespace webrtc_jni | 2549 } // namespace webrtc_jni |
OLD | NEW |