diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc index 517d543da5..fa52eead8f 100644 --- a/talk/app/webrtc/java/jni/peerconnection_jni.cc +++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc @@ -1349,13 +1349,15 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)( "Ljava/util/List;"); jobject j_ice_servers = GetObjectField(jni, j_rtc_config, j_ice_servers_id); - jfieldID j_audio_jitter_buffer_max_packets_id = GetFieldID( - jni, j_rtc_config_class, "audioJitterBufferMaxPackets", - "I"); + jfieldID j_audio_jitter_buffer_max_packets_id = + GetFieldID(jni, j_rtc_config_class, "audioJitterBufferMaxPackets", "I"); jfieldID j_audio_jitter_buffer_fast_accelerate_id = GetFieldID( jni, j_rtc_config_class, "audioJitterBufferFastAccelerate", "Z"); - PeerConnectionInterface::RTCConfiguration rtc_config; + jfieldID j_ice_connection_receiving_timeout_id = + GetFieldID(jni, j_rtc_config_class, "iceConnectionReceivingTimeout", "I"); + + PeerConnectionInterface::RTCConfiguration rtc_config; rtc_config.type = JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type); rtc_config.bundle_policy = JavaBundlePolicyToNativeType(jni, j_bundle_policy); @@ -1368,6 +1370,8 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)( GetIntField(jni, j_rtc_config, j_audio_jitter_buffer_max_packets_id); rtc_config.audio_jitter_buffer_fast_accelerate = GetBooleanField( jni, j_rtc_config, j_audio_jitter_buffer_fast_accelerate_id); + rtc_config.ice_connection_receiving_timeout = + GetIntField(jni, j_rtc_config, j_ice_connection_receiving_timeout_id); PCOJava* observer = reinterpret_cast(observer_p); observer->SetConstraints(new ConstraintsWrapper(jni, j_constraints)); @@ -1484,13 +1488,6 @@ JOW(void, PeerConnection_setRemoteDescription)( observer, JavaSdpToNativeSdp(jni, j_sdp)); } -JOW(void, PeerConnection_setIceConnectionReceivingTimeout)(JNIEnv* jni, - jobject j_pc, - jint timeout_ms) { - return ExtractNativePC(jni, j_pc) - ->SetIceConnectionReceivingTimeout(timeout_ms); -} - JOW(jboolean, PeerConnection_updateIce)( JNIEnv* jni, jobject j_pc, jobject j_ice_servers, jobject j_constraints) { PeerConnectionInterface::IceServers ice_servers; diff --git a/talk/app/webrtc/java/src/org/webrtc/PeerConnection.java b/talk/app/webrtc/java/src/org/webrtc/PeerConnection.java index 829f0fb297..a7b79c7b25 100644 --- a/talk/app/webrtc/java/src/org/webrtc/PeerConnection.java +++ b/talk/app/webrtc/java/src/org/webrtc/PeerConnection.java @@ -138,6 +138,7 @@ public class PeerConnection { public TcpCandidatePolicy tcpCandidatePolicy; public int audioJitterBufferMaxPackets; public boolean audioJitterBufferFastAccelerate; + public int iceConnectionReceivingTimeout; public RTCConfiguration(List iceServers) { iceTransportsType = IceTransportsType.ALL; @@ -147,6 +148,7 @@ public class PeerConnection { this.iceServers = iceServers; audioJitterBufferMaxPackets = 50; audioJitterBufferFastAccelerate = false; + iceConnectionReceivingTimeout = -1; } }; @@ -180,8 +182,6 @@ public class PeerConnection { public native void setRemoteDescription( SdpObserver observer, SessionDescription sdp); - public native void setIceConnectionReceivingTimeout(int timeoutMs); - public native boolean updateIce( List iceServers, MediaConstraints constraints); diff --git a/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm b/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm index 32298c8d72..58d12ace4c 100644 --- a/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm +++ b/talk/app/webrtc/objc/RTCPeerConnectionInterface.mm @@ -38,6 +38,7 @@ @synthesize rtcpMuxPolicy = _rtcpMuxPolicy; @synthesize tcpCandidatePolicy = _tcpCandidatePolicy; @synthesize audioJitterBufferMaxPackets = _audioJitterBufferMaxPackets; +@synthesize iceConnectionReceivingTimeout = _iceConnectionReceivingTimeout; - (instancetype)init { if (self = [super init]) { @@ -49,6 +50,7 @@ _tcpCandidatePolicy = [RTCEnumConverter tcpCandidatePolicyForNativeEnum:config.tcp_candidate_policy]; _audioJitterBufferMaxPackets = config.audio_jitter_buffer_max_packets; + _iceConnectionReceivingTimeout = config.ice_connection_receiving_timeout; } return self; } @@ -57,13 +59,15 @@ bundlePolicy:(RTCBundlePolicy)bundlePolicy rtcpMuxPolicy:(RTCRtcpMuxPolicy)rtcpMuxPolicy tcpCandidatePolicy:(RTCTcpCandidatePolicy)tcpCandidatePolicy - audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets { + audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets + iceConnectionReceivingTimeout:(int)iceConnectionReceivingTimeout { if (self = [super init]) { _iceTransportsType = iceTransportsType; _bundlePolicy = bundlePolicy; _rtcpMuxPolicy = rtcpMuxPolicy; _tcpCandidatePolicy = tcpCandidatePolicy; _audioJitterBufferMaxPackets = audioJitterBufferMaxPackets; + _iceConnectionReceivingTimeout = iceConnectionReceivingTimeout; } return self; } @@ -81,6 +85,8 @@ nativeConfig.tcp_candidate_policy = [RTCEnumConverter nativeEnumForTcpCandidatePolicy:_tcpCandidatePolicy]; nativeConfig.audio_jitter_buffer_max_packets = _audioJitterBufferMaxPackets; + nativeConfig.ice_connection_receiving_timeout = + _iceConnectionReceivingTimeout; return nativeConfig; } diff --git a/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h b/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h index fd7af620d9..b0cc72b5b7 100644 --- a/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h +++ b/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h @@ -63,11 +63,13 @@ typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) { @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; @property(nonatomic, assign) int audioJitterBufferMaxPackets; +@property(nonatomic, assign) int iceConnectionReceivingTimeout; - (instancetype)initWithIceTransportsType:(RTCIceTransportsType)iceTransportsType bundlePolicy:(RTCBundlePolicy)bundlePolicy rtcpMuxPolicy:(RTCRtcpMuxPolicy)rtcpMuxPolicy tcpCandidatePolicy:(RTCTcpCandidatePolicy)tcpCandidatePolicy - audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets; + audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets + iceConnectionReceivingTimeout:(int)iceConnectionReceivingTimeout; @end diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc index ef5836bbdd..c147aef565 100644 --- a/talk/app/webrtc/peerconnection.cc +++ b/talk/app/webrtc/peerconnection.cc @@ -649,10 +649,6 @@ void PeerConnection::PostSetSessionDescriptionFailure( signaling_thread()->Post(this, MSG_SET_SESSIONDESCRIPTION_FAILED, msg); } -void PeerConnection::SetIceConnectionReceivingTimeout(int timeout_ms) { - session_->SetIceConnectionReceivingTimeout(timeout_ms); -} - bool PeerConnection::UpdateIce(const IceServers& configuration, const MediaConstraintsInterface* constraints) { return false; @@ -696,6 +692,8 @@ bool PeerConnection::UpdateIce(const RTCConfiguration& config) { } } } + session_->SetIceConnectionReceivingTimeout( + config.ice_connection_receiving_timeout); return session_->SetIceTransports(config.type); } diff --git a/talk/app/webrtc/peerconnection.h b/talk/app/webrtc/peerconnection.h index df4cb78fc1..2160afb241 100644 --- a/talk/app/webrtc/peerconnection.h +++ b/talk/app/webrtc/peerconnection.h @@ -100,7 +100,6 @@ class PeerConnection : public PeerConnectionInterface, SessionDescriptionInterface* desc); virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, SessionDescriptionInterface* desc); - virtual void SetIceConnectionReceivingTimeout(int timeout_ms); // TODO(mallinath) : Deprecated version, remove after all clients are updated. virtual bool UpdateIce(const IceServers& configuration, const MediaConstraintsInterface* constraints); diff --git a/talk/app/webrtc/peerconnectioninterface.h b/talk/app/webrtc/peerconnectioninterface.h index ee81f7c916..a3af0e715c 100644 --- a/talk/app/webrtc/peerconnectioninterface.h +++ b/talk/app/webrtc/peerconnectioninterface.h @@ -233,6 +233,9 @@ class PeerConnectionInterface : public rtc::RefCountInterface { // TODO(hbos): Change into class with private data and public getters. struct RTCConfiguration { + static const int kUndefined = -1; + // Default maximum number of packets in the audio jitter buffer. + static const int kAudioJitterBufferMaxPackets = 50; // TODO(pthatcher): Rename this ice_transport_type, but update // Chromium at the same time. IceTransportsType type; @@ -247,6 +250,7 @@ class PeerConnectionInterface : public rtc::RefCountInterface { TcpCandidatePolicy tcp_candidate_policy; int audio_jitter_buffer_max_packets; bool audio_jitter_buffer_fast_accelerate; + int ice_connection_receiving_timeout; std::vector> certificates; RTCConfiguration() @@ -255,8 +259,9 @@ class PeerConnectionInterface : public rtc::RefCountInterface { bundle_policy(kBundlePolicyBalanced), rtcp_mux_policy(kRtcpMuxPolicyNegotiate), tcp_candidate_policy(kTcpCandidatePolicyEnabled), - audio_jitter_buffer_max_packets(50), - audio_jitter_buffer_fast_accelerate(false) {} + audio_jitter_buffer_max_packets(kAudioJitterBufferMaxPackets), + audio_jitter_buffer_fast_accelerate(false), + ice_connection_receiving_timeout(kUndefined) {} }; struct RTCOfferAnswerOptions { @@ -358,8 +363,6 @@ class PeerConnectionInterface : public rtc::RefCountInterface { // The |observer| callback will be called when done. virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer, SessionDescriptionInterface* desc) = 0; - // Sets the ICE connection receiving timeout value in milliseconds. - virtual void SetIceConnectionReceivingTimeout(int timeout_ms) {} // Restarts or updates the ICE Agent process of gathering local candidates // and pinging remote candidates. virtual bool UpdateIce(const IceServers& configuration, diff --git a/talk/app/webrtc/peerconnectionproxy.h b/talk/app/webrtc/peerconnectionproxy.h index 0959d3fe91..2f015cdf19 100644 --- a/talk/app/webrtc/peerconnectionproxy.h +++ b/talk/app/webrtc/peerconnectionproxy.h @@ -62,7 +62,6 @@ BEGIN_PROXY_MAP(PeerConnection) const MediaConstraintsInterface*) PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*) PROXY_METHOD1(void, RegisterUMAObserver, UMAObserver*) - PROXY_METHOD1(void, SetIceConnectionReceivingTimeout, int) PROXY_METHOD0(SignalingState, signaling_state) PROXY_METHOD0(IceState, ice_state) PROXY_METHOD0(IceConnectionState, ice_connection_state) diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc index f73cf39806..838ad93af1 100644 --- a/talk/app/webrtc/webrtcsession.cc +++ b/talk/app/webrtc/webrtcsession.cc @@ -584,6 +584,9 @@ bool WebRtcSession::Initialize( certificate = rtc_configuration.certificates[0]; } + SetIceConnectionReceivingTimeout( + rtc_configuration.ice_connection_receiving_timeout); + // TODO(perkj): Take |constraints| into consideration. Return false if not all // mandatory constraints can be fulfilled. Note that |constraints| // can be null.