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 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 jni, j_rtc_config_class, "tcpCandidatePolicy", | 1314 jni, j_rtc_config_class, "tcpCandidatePolicy", |
1315 "Lorg/webrtc/PeerConnection$TcpCandidatePolicy;"); | 1315 "Lorg/webrtc/PeerConnection$TcpCandidatePolicy;"); |
1316 jobject j_tcp_candidate_policy = GetObjectField( | 1316 jobject j_tcp_candidate_policy = GetObjectField( |
1317 jni, j_rtc_config, j_tcp_candidate_policy_id); | 1317 jni, j_rtc_config, j_tcp_candidate_policy_id); |
1318 | 1318 |
1319 jfieldID j_ice_servers_id = GetFieldID( | 1319 jfieldID j_ice_servers_id = GetFieldID( |
1320 jni, j_rtc_config_class, "iceServers", | 1320 jni, j_rtc_config_class, "iceServers", |
1321 "Ljava/util/List;"); | 1321 "Ljava/util/List;"); |
1322 jobject j_ice_servers = GetObjectField(jni, j_rtc_config, j_ice_servers_id); | 1322 jobject j_ice_servers = GetObjectField(jni, j_rtc_config, j_ice_servers_id); |
1323 | 1323 |
1324 jfieldID j_audio_jitter_buffer_max_packets_id = GetFieldID( | 1324 jfieldID j_audio_jitter_buffer_max_packets_id = |
1325 jni, j_rtc_config_class, "audioJitterBufferMaxPackets", | 1325 GetFieldID(jni, j_rtc_config_class, "audioJitterBufferMaxPackets", "I"); |
1326 "I"); | |
1327 jfieldID j_audio_jitter_buffer_fast_accelerate_id = GetFieldID( | 1326 jfieldID j_audio_jitter_buffer_fast_accelerate_id = GetFieldID( |
1328 jni, j_rtc_config_class, "audioJitterBufferFastAccelerate", "Z"); | 1327 jni, j_rtc_config_class, "audioJitterBufferFastAccelerate", "Z"); |
| 1328 |
| 1329 jfieldID j_ice_connection_receiving_timeout_id = |
| 1330 GetFieldID(jni, j_rtc_config_class, "iceConnectionReceivingTimeout", "I"); |
| 1331 |
1329 PeerConnectionInterface::RTCConfiguration rtc_config; | 1332 PeerConnectionInterface::RTCConfiguration rtc_config; |
1330 | |
1331 rtc_config.type = | 1333 rtc_config.type = |
1332 JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type); | 1334 JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type); |
1333 rtc_config.bundle_policy = JavaBundlePolicyToNativeType(jni, j_bundle_policy); | 1335 rtc_config.bundle_policy = JavaBundlePolicyToNativeType(jni, j_bundle_policy); |
1334 rtc_config.rtcp_mux_policy = | 1336 rtc_config.rtcp_mux_policy = |
1335 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy); | 1337 JavaRtcpMuxPolicyToNativeType(jni, j_rtcp_mux_policy); |
1336 rtc_config.tcp_candidate_policy = | 1338 rtc_config.tcp_candidate_policy = |
1337 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy); | 1339 JavaTcpCandidatePolicyToNativeType(jni, j_tcp_candidate_policy); |
1338 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config.servers); | 1340 JavaIceServersToJsepIceServers(jni, j_ice_servers, &rtc_config.servers); |
1339 rtc_config.audio_jitter_buffer_max_packets = | 1341 rtc_config.audio_jitter_buffer_max_packets = |
1340 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id); | 1342 GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id); |
1341 rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField( | 1343 rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField( |
1342 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id); | 1344 jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id); |
| 1345 rtc_config.ice_connection_receiving_timeout = |
| 1346 GetIntField(jni, j_rtc_config, j_ice_connection_receiving_timeout_id); |
1343 | 1347 |
1344 PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p); | 1348 PCOJava* observer = reinterpret_cast<PCOJava*>(observer_p); |
1345 observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints)); | 1349 observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints)); |
1346 rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection( | 1350 rtc::scoped_refptr<PeerConnectionInterface> pc(f->CreatePeerConnection( |
1347 rtc_config, observer->constraints(), NULL, NULL, observer)); | 1351 rtc_config, observer->constraints(), NULL, NULL, observer)); |
1348 return (jlong)pc.release(); | 1352 return (jlong)pc.release(); |
1349 } | 1353 } |
1350 | 1354 |
1351 static rtc::scoped_refptr<PeerConnectionInterface> ExtractNativePC( | 1355 static rtc::scoped_refptr<PeerConnectionInterface> ExtractNativePC( |
1352 JNIEnv* jni, jobject j_pc) { | 1356 JNIEnv* jni, jobject j_pc) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 JOW(void, PeerConnection_setRemoteDescription)( | 1453 JOW(void, PeerConnection_setRemoteDescription)( |
1450 JNIEnv* jni, jobject j_pc, | 1454 JNIEnv* jni, jobject j_pc, |
1451 jobject j_observer, jobject j_sdp) { | 1455 jobject j_observer, jobject j_sdp) { |
1452 rtc::scoped_refptr<SetSdpObserverWrapper> observer( | 1456 rtc::scoped_refptr<SetSdpObserverWrapper> observer( |
1453 new rtc::RefCountedObject<SetSdpObserverWrapper>( | 1457 new rtc::RefCountedObject<SetSdpObserverWrapper>( |
1454 jni, j_observer, reinterpret_cast<ConstraintsWrapper*>(NULL))); | 1458 jni, j_observer, reinterpret_cast<ConstraintsWrapper*>(NULL))); |
1455 ExtractNativePC(jni, j_pc)->SetRemoteDescription( | 1459 ExtractNativePC(jni, j_pc)->SetRemoteDescription( |
1456 observer, JavaSdpToNativeSdp(jni, j_sdp)); | 1460 observer, JavaSdpToNativeSdp(jni, j_sdp)); |
1457 } | 1461 } |
1458 | 1462 |
1459 JOW(void, PeerConnection_setIceConnectionReceivingTimeout)(JNIEnv* jni, | |
1460 jobject j_pc, | |
1461 jint timeout_ms) { | |
1462 return ExtractNativePC(jni, j_pc) | |
1463 ->SetIceConnectionReceivingTimeout(timeout_ms); | |
1464 } | |
1465 | |
1466 JOW(jboolean, PeerConnection_updateIce)( | 1463 JOW(jboolean, PeerConnection_updateIce)( |
1467 JNIEnv* jni, jobject j_pc, jobject j_ice_servers, jobject j_constraints) { | 1464 JNIEnv* jni, jobject j_pc, jobject j_ice_servers, jobject j_constraints) { |
1468 PeerConnectionInterface::IceServers ice_servers; | 1465 PeerConnectionInterface::IceServers ice_servers; |
1469 JavaIceServersToJsepIceServers(jni, j_ice_servers, &ice_servers); | 1466 JavaIceServersToJsepIceServers(jni, j_ice_servers, &ice_servers); |
1470 scoped_ptr<ConstraintsWrapper> constraints( | 1467 scoped_ptr<ConstraintsWrapper> constraints( |
1471 new ConstraintsWrapper(jni, j_constraints)); | 1468 new ConstraintsWrapper(jni, j_constraints)); |
1472 return ExtractNativePC(jni, j_pc)->UpdateIce(ice_servers, constraints.get()); | 1469 return ExtractNativePC(jni, j_pc)->UpdateIce(ice_servers, constraints.get()); |
1473 } | 1470 } |
1474 | 1471 |
1475 JOW(jboolean, PeerConnection_nativeAddIceCandidate)( | 1472 JOW(jboolean, PeerConnection_nativeAddIceCandidate)( |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 } | 1674 } |
1678 | 1675 |
1679 JOW(void, VideoTrack_nativeRemoveRenderer)( | 1676 JOW(void, VideoTrack_nativeRemoveRenderer)( |
1680 JNIEnv* jni, jclass, | 1677 JNIEnv* jni, jclass, |
1681 jlong j_video_track_pointer, jlong j_renderer_pointer) { | 1678 jlong j_video_track_pointer, jlong j_renderer_pointer) { |
1682 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)->RemoveRenderer( | 1679 reinterpret_cast<VideoTrackInterface*>(j_video_track_pointer)->RemoveRenderer( |
1683 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer)); | 1680 reinterpret_cast<VideoRendererInterface*>(j_renderer_pointer)); |
1684 } | 1681 } |
1685 | 1682 |
1686 } // namespace webrtc_jni | 1683 } // namespace webrtc_jni |
OLD | NEW |