Passing the new policy from PeerConnection RTCConfiguration to
p2ptransportchannel. This CL does not use the new policy yet. BUG= Review URL: https://codereview.webrtc.org/1369773003 Cr-Commit-Position: refs/heads/master@{#10092}
This commit is contained in:
parent
cb3649b40b
commit
1f429e3418
@ -98,6 +98,7 @@ ClassReferenceHolder::ClassReferenceHolder(JNIEnv* jni) {
|
||||
LoadClass(jni, "org/webrtc/MediaStream");
|
||||
LoadClass(jni, "org/webrtc/MediaStreamTrack$State");
|
||||
LoadClass(jni, "org/webrtc/PeerConnection$BundlePolicy");
|
||||
LoadClass(jni, "org/webrtc/PeerConnection$ContinualGatheringPolicy");
|
||||
LoadClass(jni, "org/webrtc/PeerConnection$RtcpMuxPolicy");
|
||||
LoadClass(jni, "org/webrtc/PeerConnection$IceConnectionState");
|
||||
LoadClass(jni, "org/webrtc/PeerConnection$IceGatheringState");
|
||||
|
||||
@ -1322,6 +1322,23 @@ static rtc::KeyType JavaKeyTypeToNativeType(JNIEnv* jni, jobject j_key_type) {
|
||||
return rtc::KT_ECDSA;
|
||||
}
|
||||
|
||||
static PeerConnectionInterface::ContinualGatheringPolicy
|
||||
JavaContinualGatheringPolicyToNativeType(
|
||||
JNIEnv* jni, jobject j_gathering_policy) {
|
||||
std::string enum_name = GetJavaEnumName(
|
||||
jni, "org/webrtc/PeerConnection$ContinualGatheringPolicy",
|
||||
j_gathering_policy);
|
||||
if (enum_name == "GATHER_ONCE")
|
||||
return PeerConnectionInterface::GATHER_ONCE;
|
||||
|
||||
if (enum_name == "GATHER_CONTINUALLY")
|
||||
return PeerConnectionInterface::GATHER_CONTINUALLY;
|
||||
|
||||
RTC_CHECK(false) << "Unexpected ContinualGatheringPolicy enum name "
|
||||
<< enum_name;
|
||||
return PeerConnectionInterface::GATHER_ONCE;
|
||||
}
|
||||
|
||||
static void JavaIceServersToJsepIceServers(
|
||||
JNIEnv* jni, jobject j_ice_servers,
|
||||
PeerConnectionInterface::IceServers* ice_servers) {
|
||||
@ -1409,6 +1426,12 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)(
|
||||
"Lorg/webrtc/PeerConnection$KeyType;");
|
||||
jobject j_key_type = GetObjectField(jni, j_rtc_config, j_key_type_id);
|
||||
|
||||
jfieldID j_continual_gathering_policy_id =
|
||||
GetFieldID(jni, j_rtc_config_class, "continualGatheringPolicy",
|
||||
"Lorg/webrtc/PeerConnection$ContinualGatheringPolicy;");
|
||||
jobject j_continual_gathering_policy =
|
||||
GetObjectField(jni, j_rtc_config, j_continual_gathering_policy_id);
|
||||
|
||||
PeerConnectionInterface::RTCConfiguration rtc_config;
|
||||
rtc_config.type =
|
||||
JavaIceTransportsTypeToNativeType(jni, j_ice_transports_type);
|
||||
@ -1424,6 +1447,9 @@ JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)(
|
||||
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);
|
||||
rtc_config.continual_gathering_policy =
|
||||
JavaContinualGatheringPolicyToNativeType(
|
||||
jni, j_continual_gathering_policy);
|
||||
|
||||
// Create ECDSA certificate.
|
||||
if (JavaKeyTypeToNativeType(jni, j_key_type) == rtc::KT_ECDSA) {
|
||||
|
||||
@ -135,6 +135,11 @@ public class PeerConnection {
|
||||
RSA, ECDSA
|
||||
}
|
||||
|
||||
/** Java version of PeerConnectionInterface.ContinualGatheringPolicy */
|
||||
public enum ContinualGatheringPolicy {
|
||||
GATHER_ONCE, GATHER_CONTINUALLY
|
||||
}
|
||||
|
||||
/** Java version of PeerConnectionInterface.RTCConfiguration */
|
||||
public static class RTCConfiguration {
|
||||
public IceTransportsType iceTransportsType;
|
||||
@ -146,6 +151,7 @@ public class PeerConnection {
|
||||
public boolean audioJitterBufferFastAccelerate;
|
||||
public int iceConnectionReceivingTimeout;
|
||||
public KeyType keyType;
|
||||
public ContinualGatheringPolicy continualGatheringPolicy;
|
||||
|
||||
public RTCConfiguration(List<IceServer> iceServers) {
|
||||
iceTransportsType = IceTransportsType.ALL;
|
||||
@ -157,6 +163,7 @@ public class PeerConnection {
|
||||
audioJitterBufferFastAccelerate = false;
|
||||
iceConnectionReceivingTimeout = -1;
|
||||
keyType = KeyType.ECDSA;
|
||||
continualGatheringPolicy = ContinualGatheringPolicy.GATHER_ONCE;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -696,8 +696,7 @@ bool PeerConnection::UpdateIce(const RTCConfiguration& config) {
|
||||
}
|
||||
}
|
||||
}
|
||||
session_->SetIceConnectionReceivingTimeout(
|
||||
config.ice_connection_receiving_timeout);
|
||||
session_->SetIceConfig(session_->ParseIceConfig(config));
|
||||
return session_->SetIceTransports(config.type);
|
||||
}
|
||||
|
||||
|
||||
@ -225,6 +225,11 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||
kTcpCandidatePolicyDisabled
|
||||
};
|
||||
|
||||
enum ContinualGatheringPolicy {
|
||||
GATHER_ONCE,
|
||||
GATHER_CONTINUALLY
|
||||
};
|
||||
|
||||
// TODO(hbos): Change into class with private data and public getters.
|
||||
struct RTCConfiguration {
|
||||
static const int kUndefined = -1;
|
||||
@ -245,6 +250,7 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||
int audio_jitter_buffer_max_packets;
|
||||
bool audio_jitter_buffer_fast_accelerate;
|
||||
int ice_connection_receiving_timeout;
|
||||
ContinualGatheringPolicy continual_gathering_policy;
|
||||
std::vector<rtc::scoped_refptr<rtc::RTCCertificate>> certificates;
|
||||
|
||||
RTCConfiguration()
|
||||
@ -255,7 +261,8 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||
tcp_candidate_policy(kTcpCandidatePolicyEnabled),
|
||||
audio_jitter_buffer_max_packets(kAudioJitterBufferMaxPackets),
|
||||
audio_jitter_buffer_fast_accelerate(false),
|
||||
ice_connection_receiving_timeout(kUndefined) {}
|
||||
ice_connection_receiving_timeout(kUndefined),
|
||||
continual_gathering_policy(GATHER_ONCE) {}
|
||||
};
|
||||
|
||||
struct RTCOfferAnswerOptions {
|
||||
|
||||
@ -608,8 +608,7 @@ bool WebRtcSession::Initialize(
|
||||
certificate = rtc_configuration.certificates[0];
|
||||
}
|
||||
|
||||
SetIceConnectionReceivingTimeout(
|
||||
rtc_configuration.ice_connection_receiving_timeout);
|
||||
SetIceConfig(ParseIceConfig(rtc_configuration));
|
||||
|
||||
// TODO(perkj): Take |constraints| into consideration. Return false if not all
|
||||
// mandatory constraints can be fulfilled. Note that |constraints|
|
||||
@ -782,6 +781,15 @@ bool WebRtcSession::Initialize(
|
||||
return true;
|
||||
}
|
||||
|
||||
cricket::IceConfig WebRtcSession::ParseIceConfig(
|
||||
const PeerConnectionInterface::RTCConfiguration& config) const {
|
||||
cricket::IceConfig ice_config;
|
||||
ice_config.receiving_timeout_ms = config.ice_connection_receiving_timeout;
|
||||
ice_config.gather_continually = (config.continual_gathering_policy ==
|
||||
PeerConnectionInterface::GATHER_CONTINUALLY);
|
||||
return ice_config;
|
||||
}
|
||||
|
||||
void WebRtcSession::Terminate() {
|
||||
SetState(STATE_RECEIVEDTERMINATE);
|
||||
RemoveUnusedChannels(NULL);
|
||||
|
||||
@ -178,6 +178,9 @@ class WebRtcSession : public cricket::BaseSession,
|
||||
|
||||
bool SetIceTransports(PeerConnectionInterface::IceTransportsType type);
|
||||
|
||||
cricket::IceConfig ParseIceConfig(
|
||||
const PeerConnectionInterface::RTCConfiguration& config) const;
|
||||
|
||||
const SessionDescriptionInterface* local_description() const {
|
||||
return local_desc_.get();
|
||||
}
|
||||
|
||||
@ -197,8 +197,8 @@ class DtlsTransportChannelWrapper : public TransportChannelImpl {
|
||||
channel_->AddRemoteCandidate(candidate);
|
||||
}
|
||||
|
||||
void SetReceivingTimeout(int receiving_timeout_ms) override {
|
||||
channel_->SetReceivingTimeout(receiving_timeout_ms);
|
||||
void SetIceConfig(const IceConfig& config) override {
|
||||
channel_->SetIceConfig(config);
|
||||
}
|
||||
|
||||
// Needed by DtlsTransport.
|
||||
|
||||
@ -182,11 +182,13 @@ class FakeTransportChannel : public TransportChannelImpl,
|
||||
|
||||
void SetReceiving(bool receiving) { set_receiving(receiving); }
|
||||
|
||||
void SetReceivingTimeout(int timeout) override {
|
||||
receiving_timeout_ = timeout;
|
||||
void SetIceConfig(const IceConfig& config) override {
|
||||
receiving_timeout_ = config.receiving_timeout_ms;
|
||||
gather_continually_ = config.gather_continually;
|
||||
}
|
||||
|
||||
int receiving_timeout() const { return receiving_timeout_; }
|
||||
bool gather_continually() const { return gather_continually_; }
|
||||
|
||||
int SendPacket(const char* data,
|
||||
size_t len,
|
||||
@ -319,6 +321,7 @@ class FakeTransportChannel : public TransportChannelImpl,
|
||||
std::vector<std::string> srtp_ciphers_;
|
||||
std::string chosen_srtp_cipher_;
|
||||
int receiving_timeout_ = -1;
|
||||
bool gather_continually_ = false;
|
||||
IceRole role_ = ICEROLE_UNKNOWN;
|
||||
uint64 tiebreaker_ = 0;
|
||||
std::string ice_ufrag_;
|
||||
|
||||
@ -355,19 +355,22 @@ void P2PTransportChannel::SetRemoteIceMode(IceMode mode) {
|
||||
remote_ice_mode_ = mode;
|
||||
}
|
||||
|
||||
void P2PTransportChannel::SetReceivingTimeout(int receiving_timeout_ms) {
|
||||
if (receiving_timeout_ms < 0) {
|
||||
void P2PTransportChannel::SetIceConfig(const IceConfig& config) {
|
||||
gather_continually_ = config.gather_continually;
|
||||
LOG(LS_INFO) << "Set gather_continually to " << gather_continually_;
|
||||
|
||||
if (config.receiving_timeout_ms < 0) {
|
||||
return;
|
||||
}
|
||||
receiving_timeout_ = receiving_timeout_ms;
|
||||
receiving_timeout_ = config.receiving_timeout_ms;
|
||||
check_receiving_delay_ =
|
||||
std::max(MIN_CHECK_RECEIVING_DELAY, receiving_timeout_ / 10);
|
||||
|
||||
for (Connection* connection : connections_) {
|
||||
connection->set_receiving_timeout(receiving_timeout_);
|
||||
}
|
||||
LOG(LS_VERBOSE) << "Set ICE receiving timeout to " << receiving_timeout_
|
||||
<< " milliseconds";
|
||||
LOG(LS_INFO) << "Set ICE receiving timeout to " << receiving_timeout_
|
||||
<< " milliseconds";
|
||||
}
|
||||
|
||||
// Go into the state of processing candidates, and running in general
|
||||
|
||||
@ -74,9 +74,9 @@ class P2PTransportChannel : public TransportChannelImpl,
|
||||
return gathering_state_;
|
||||
}
|
||||
void AddRemoteCandidate(const Candidate& candidate) override;
|
||||
// Sets the receiving timeout in milliseconds.
|
||||
// Sets the receiving timeout and gather_continually.
|
||||
// This also sets the check_receiving_delay proportionally.
|
||||
void SetReceivingTimeout(int receiving_timeout_ms) override;
|
||||
void SetIceConfig(const IceConfig& config) override;
|
||||
|
||||
// From TransportChannel:
|
||||
int SendPacket(const char* data,
|
||||
@ -250,6 +250,7 @@ class P2PTransportChannel : public TransportChannelImpl,
|
||||
int check_receiving_delay_;
|
||||
int receiving_timeout_;
|
||||
uint32 last_ping_sent_ms_ = 0;
|
||||
bool gather_continually_ = false;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
|
||||
};
|
||||
|
||||
@ -100,6 +100,14 @@ enum {
|
||||
MSG_CANDIDATE
|
||||
};
|
||||
|
||||
static cricket::IceConfig CreateIceConfig(int receiving_timeout_ms,
|
||||
bool gather_continually) {
|
||||
cricket::IceConfig config;
|
||||
config.receiving_timeout_ms = receiving_timeout_ms;
|
||||
config.gather_continually = gather_continually;
|
||||
return config;
|
||||
}
|
||||
|
||||
// This test simulates 2 P2P endpoints that want to establish connectivity
|
||||
// with each other over various network topologies and conditions, which can be
|
||||
// specified in each individial test.
|
||||
@ -386,7 +394,6 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
void SetAllowTcpListen(int endpoint, bool allow_tcp_listen) {
|
||||
return GetEndpoint(endpoint)->SetAllowTcpListen(allow_tcp_listen);
|
||||
}
|
||||
|
||||
bool IsLocalToPrflxOrTheReverse(const Result& expected) {
|
||||
return (
|
||||
(expected.local_type == "local" && expected.remote_type == "prflx") ||
|
||||
@ -1498,8 +1505,9 @@ TEST_F(P2PTransportChannelMultihomedTest, TestFailoverControlledSide) {
|
||||
CreateChannels(1);
|
||||
|
||||
// Make the receiving timeout shorter for testing.
|
||||
ep1_ch1()->SetReceivingTimeout(1000);
|
||||
ep2_ch1()->SetReceivingTimeout(1000);
|
||||
cricket::IceConfig config = CreateIceConfig(1000, false);
|
||||
ep1_ch1()->SetIceConfig(config);
|
||||
ep2_ch1()->SetIceConfig(config);
|
||||
|
||||
EXPECT_TRUE_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
|
||||
ep2_ch1()->receiving() && ep2_ch1()->writable(),
|
||||
@ -1549,8 +1557,9 @@ TEST_F(P2PTransportChannelMultihomedTest, TestFailoverControllingSide) {
|
||||
// Create channels and let them go writable, as usual.
|
||||
CreateChannels(1);
|
||||
// Make the receiving timeout shorter for testing.
|
||||
ep1_ch1()->SetReceivingTimeout(1000);
|
||||
ep2_ch1()->SetReceivingTimeout(1000);
|
||||
cricket::IceConfig config = CreateIceConfig(1000, false);
|
||||
ep1_ch1()->SetIceConfig(config);
|
||||
ep2_ch1()->SetIceConfig(config);
|
||||
EXPECT_TRUE_WAIT(ep1_ch1()->receiving() && ep1_ch1()->writable() &&
|
||||
ep2_ch1()->receiving() && ep2_ch1()->writable(),
|
||||
1000);
|
||||
@ -1796,7 +1805,7 @@ TEST_F(P2PTransportChannelPingTest, TestReceivingStateChange) {
|
||||
// small.
|
||||
EXPECT_LE(1000, ch.receiving_timeout());
|
||||
EXPECT_LE(200, ch.check_receiving_delay());
|
||||
ch.SetReceivingTimeout(500);
|
||||
ch.SetIceConfig(CreateIceConfig(500, false));
|
||||
EXPECT_EQ(500, ch.receiving_timeout());
|
||||
EXPECT_EQ(50, ch.check_receiving_delay());
|
||||
ch.Connect();
|
||||
@ -2018,7 +2027,7 @@ TEST_F(P2PTransportChannelPingTest, TestDontPruneWhenWeak) {
|
||||
conn2->SignalNominated(conn2);
|
||||
EXPECT_TRUE_WAIT(conn1->pruned(), 3000);
|
||||
|
||||
ch.SetReceivingTimeout(500);
|
||||
ch.SetIceConfig(CreateIceConfig(500, false));
|
||||
// Wait until conn2 becomes not receiving.
|
||||
EXPECT_TRUE_WAIT(!conn2->receiving(), 3000);
|
||||
|
||||
|
||||
@ -206,8 +206,8 @@ void BaseSession::SetError(Error error, const std::string& error_desc) {
|
||||
}
|
||||
}
|
||||
|
||||
void BaseSession::SetIceConnectionReceivingTimeout(int timeout_ms) {
|
||||
transport_controller_->SetIceConnectionReceivingTimeout(timeout_ms);
|
||||
void BaseSession::SetIceConfig(const IceConfig& config) {
|
||||
transport_controller_->SetIceConfig(config);
|
||||
}
|
||||
|
||||
void BaseSession::MaybeStartGathering() {
|
||||
|
||||
@ -146,7 +146,7 @@ class BaseSession : public sigslot::has_slots<>,
|
||||
// TODO(ronghuawu): remove the SetError method that doesn't take |error_desc|.
|
||||
virtual void SetError(Error error, const std::string& error_desc);
|
||||
|
||||
void SetIceConnectionReceivingTimeout(int timeout_ms);
|
||||
void SetIceConfig(const IceConfig& ice_config);
|
||||
|
||||
// Start gathering candidates for any new transports, or transports doing an
|
||||
// ICE restart.
|
||||
|
||||
@ -125,10 +125,10 @@ bool Transport::GetRemoteSSLCertificate(rtc::SSLCertificate** cert) {
|
||||
return iter->second->GetRemoteSSLCertificate(cert);
|
||||
}
|
||||
|
||||
void Transport::SetChannelReceivingTimeout(int timeout_ms) {
|
||||
channel_receiving_timeout_ = timeout_ms;
|
||||
void Transport::SetIceConfig(const IceConfig& config) {
|
||||
ice_config_ = config;
|
||||
for (const auto& kv : channels_) {
|
||||
kv.second->SetReceivingTimeout(timeout_ms);
|
||||
kv.second->SetIceConfig(ice_config_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ TransportChannelImpl* Transport::CreateChannel(int component) {
|
||||
// Push down our transport state to the new channel.
|
||||
impl->SetIceRole(ice_role_);
|
||||
impl->SetIceTiebreaker(tiebreaker_);
|
||||
impl->SetReceivingTimeout(channel_receiving_timeout_);
|
||||
impl->SetIceConfig(ice_config_);
|
||||
// TODO(ronghuawu): Change CreateChannel to be able to return error since
|
||||
// below Apply**Description calls can fail.
|
||||
if (local_description_)
|
||||
|
||||
@ -139,6 +139,14 @@ struct TransportStats {
|
||||
TransportChannelStatsList channel_stats;
|
||||
};
|
||||
|
||||
// Information about ICE configuration.
|
||||
struct IceConfig {
|
||||
// The ICE connection receiving timeout value.
|
||||
int receiving_timeout_ms = -1;
|
||||
// If true, the most recent port allocator session will keep on running.
|
||||
bool gather_continually = false;
|
||||
};
|
||||
|
||||
bool BadTransportDescription(const std::string& desc, std::string* err_desc);
|
||||
|
||||
bool IceCredentialsChanged(const std::string& old_ufrag,
|
||||
@ -197,7 +205,7 @@ class Transport : public sigslot::has_slots<> {
|
||||
void SetIceTiebreaker(uint64 IceTiebreaker) { tiebreaker_ = IceTiebreaker; }
|
||||
uint64 IceTiebreaker() { return tiebreaker_; }
|
||||
|
||||
void SetChannelReceivingTimeout(int timeout_ms);
|
||||
void SetIceConfig(const IceConfig& config);
|
||||
|
||||
// Must be called before applying local session description.
|
||||
virtual void SetLocalCertificate(
|
||||
@ -399,7 +407,7 @@ class Transport : public sigslot::has_slots<> {
|
||||
IceRole ice_role_ = ICEROLE_UNKNOWN;
|
||||
uint64 tiebreaker_ = 0;
|
||||
IceMode remote_ice_mode_ = ICEMODE_FULL;
|
||||
int channel_receiving_timeout_ = -1;
|
||||
IceConfig ice_config_;
|
||||
rtc::scoped_ptr<TransportDescription> local_description_;
|
||||
rtc::scoped_ptr<TransportDescription> remote_description_;
|
||||
bool local_description_set_ = false;
|
||||
|
||||
@ -59,7 +59,7 @@ class TransportChannelImpl : public TransportChannel {
|
||||
// SetRemoteIceMode must be implemented only by the ICE transport channels.
|
||||
virtual void SetRemoteIceMode(IceMode mode) = 0;
|
||||
|
||||
virtual void SetReceivingTimeout(int timeout_ms) = 0;
|
||||
virtual void SetIceConfig(const IceConfig& config) = 0;
|
||||
|
||||
// Begins the process of attempting to make a connection to the other client.
|
||||
virtual void Connect() = 0;
|
||||
|
||||
@ -53,10 +53,9 @@ bool TransportController::SetSslMaxProtocolVersion(
|
||||
&TransportController::SetSslMaxProtocolVersion_w, this, version));
|
||||
}
|
||||
|
||||
void TransportController::SetIceConnectionReceivingTimeout(int timeout_ms) {
|
||||
void TransportController::SetIceConfig(const IceConfig& config) {
|
||||
worker_thread_->Invoke<void>(
|
||||
rtc::Bind(&TransportController::SetIceConnectionReceivingTimeout_w, this,
|
||||
timeout_ms));
|
||||
rtc::Bind(&TransportController::SetIceConfig_w, this, config));
|
||||
}
|
||||
|
||||
void TransportController::SetIceRole(IceRole ice_role) {
|
||||
@ -235,7 +234,7 @@ Transport* TransportController::GetOrCreateTransport_w(
|
||||
// The stuff below happens outside of CreateTransport_w so that unit tests
|
||||
// can override CreateTransport_w to return a different type of transport.
|
||||
transport->SetSslMaxProtocolVersion(ssl_max_version_);
|
||||
transport->SetChannelReceivingTimeout(ice_receiving_timeout_ms_);
|
||||
transport->SetIceConfig(ice_config_);
|
||||
transport->SetIceRole(ice_role_);
|
||||
transport->SetIceTiebreaker(ice_tiebreaker_);
|
||||
if (certificate_) {
|
||||
@ -297,11 +296,11 @@ bool TransportController::SetSslMaxProtocolVersion_w(
|
||||
return true;
|
||||
}
|
||||
|
||||
void TransportController::SetIceConnectionReceivingTimeout_w(int timeout_ms) {
|
||||
void TransportController::SetIceConfig_w(const IceConfig& config) {
|
||||
RTC_DCHECK(worker_thread_->IsCurrent());
|
||||
ice_receiving_timeout_ms_ = timeout_ms;
|
||||
ice_config_ = config;
|
||||
for (const auto& kv : transports_) {
|
||||
kv.second->SetChannelReceivingTimeout(timeout_ms);
|
||||
kv.second->SetIceConfig(ice_config_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ class TransportController : public sigslot::has_slots<>,
|
||||
// and WebRtcSession are combined
|
||||
bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version);
|
||||
|
||||
void SetIceConnectionReceivingTimeout(int timeout_ms);
|
||||
void SetIceConfig(const IceConfig& config);
|
||||
void SetIceRole(IceRole ice_role);
|
||||
|
||||
// TODO(deadbeef) - Return role of each transport, as role may differ from
|
||||
@ -126,7 +126,7 @@ class TransportController : public sigslot::has_slots<>,
|
||||
void DestroyAllTransports_w();
|
||||
|
||||
bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version);
|
||||
void SetIceConnectionReceivingTimeout_w(int timeout_ms);
|
||||
void SetIceConfig_w(const IceConfig& config);
|
||||
void SetIceRole_w(IceRole ice_role);
|
||||
bool GetSslRole_w(rtc::SSLRole* role);
|
||||
bool SetLocalCertificate_w(
|
||||
@ -180,10 +180,7 @@ class TransportController : public sigslot::has_slots<>,
|
||||
IceGatheringState gathering_state_ = kIceGatheringNew;
|
||||
|
||||
// TODO(deadbeef): Move the fields below down to the transports themselves
|
||||
|
||||
// Timeout value in milliseconds for which no ICE connection receives
|
||||
// any packets
|
||||
int ice_receiving_timeout_ms_ = -1;
|
||||
IceConfig ice_config_;
|
||||
IceRole ice_role_ = ICEROLE_CONTROLLING;
|
||||
// Flag which will be set to true after the first role switch
|
||||
bool ice_role_switch_ = false;
|
||||
|
||||
@ -134,6 +134,14 @@ class TransportControllerTest : public testing::Test,
|
||||
channel2->SetConnectionCount(1);
|
||||
}
|
||||
|
||||
cricket::IceConfig CreateIceConfig(int receiving_timeout_ms,
|
||||
bool gather_continually) {
|
||||
cricket::IceConfig config;
|
||||
config.receiving_timeout_ms = receiving_timeout_ms;
|
||||
config.gather_continually = gather_continually;
|
||||
return config;
|
||||
}
|
||||
|
||||
protected:
|
||||
void OnConnectionState(IceConnectionState state) {
|
||||
if (!signaling_thread_->IsCurrent()) {
|
||||
@ -189,17 +197,19 @@ class TransportControllerTest : public testing::Test,
|
||||
bool signaled_on_non_signaling_thread_ = false;
|
||||
};
|
||||
|
||||
TEST_F(TransportControllerTest, TestSetIceReceivingTimeout) {
|
||||
TEST_F(TransportControllerTest, TestSetIceConfig) {
|
||||
FakeTransportChannel* channel1 = CreateChannel("audio", 1);
|
||||
ASSERT_NE(nullptr, channel1);
|
||||
|
||||
transport_controller_->SetIceConnectionReceivingTimeout(1000);
|
||||
transport_controller_->SetIceConfig(CreateIceConfig(1000, true));
|
||||
EXPECT_EQ(1000, channel1->receiving_timeout());
|
||||
EXPECT_TRUE(channel1->gather_continually());
|
||||
|
||||
// Test that value stored in controller is applied to new channels.
|
||||
FakeTransportChannel* channel2 = CreateChannel("video", 1);
|
||||
ASSERT_NE(nullptr, channel2);
|
||||
EXPECT_EQ(1000, channel2->receiving_timeout());
|
||||
EXPECT_TRUE(channel2->gather_continually());
|
||||
}
|
||||
|
||||
TEST_F(TransportControllerTest, TestSetSslMaxProtocolVersion) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user