Add signaling to support ICE renomination.

By default, this will tell the remote side that I am supporting ICE renomination.
It does not use ICE renomination yet even if the remote side supports it.

R=deadbeef@webrtc.org, pthatcher@webrtc.org, skvlad@webrtc.org

Review URL: https://codereview.webrtc.org/2224563004 .

Cr-Commit-Position: refs/heads/master@{#13998}
This commit is contained in:
Honghai Zhang
2016-08-31 08:18:11 -07:00
parent 0e6758d7ef
commit 4cedf2b78c
22 changed files with 421 additions and 240 deletions

View File

@ -393,6 +393,15 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
bool ExpectIceRestart() const { return expect_ice_restart_; }
void SetExpectIceRenomination(bool expect_renomination) {
expect_ice_renomination_ = expect_renomination;
}
void SetExpectRemoteIceRenomination(bool expect_renomination) {
expect_remote_ice_renomination_ = expect_renomination;
}
bool ExpectIceRenomination() { return expect_ice_renomination_; }
bool ExpectRemoteIceRenomination() { return expect_remote_ice_renomination_; }
void SetReceiveAudioVideo(bool audio, bool video) {
SetReceiveAudio(audio);
SetReceiveVideo(video);
@ -670,6 +679,42 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
}
}
void VerifyLocalIceRenomination() {
ASSERT_TRUE(peer_connection_->local_description() != nullptr);
const cricket::SessionDescription* desc =
peer_connection_->local_description()->description();
const cricket::ContentInfos& contents = desc->contents();
for (auto content : contents) {
if (content.rejected)
continue;
const cricket::TransportDescription* transport_desc =
desc->GetTransportDescriptionByName(content.name);
const auto& options = transport_desc->transport_options;
auto iter = std::find(options.begin(), options.end(),
cricket::ICE_RENOMINATION_STR);
EXPECT_EQ(ExpectIceRenomination(), iter != options.end());
}
}
void VerifyRemoteIceRenomination() {
ASSERT_TRUE(peer_connection_->remote_description() != nullptr);
const cricket::SessionDescription* desc =
peer_connection_->remote_description()->description();
const cricket::ContentInfos& contents = desc->contents();
for (auto content : contents) {
if (content.rejected)
continue;
const cricket::TransportDescription* transport_desc =
desc->GetTransportDescriptionByName(content.name);
const auto& options = transport_desc->transport_options;
auto iter = std::find(options.begin(), options.end(),
cricket::ICE_RENOMINATION_STR);
EXPECT_EQ(ExpectRemoteIceRenomination(), iter != options.end());
}
}
int GetAudioOutputLevelStats(webrtc::MediaStreamTrackInterface* track) {
rtc::scoped_refptr<MockStatsObserver>
observer(new rtc::RefCountedObject<MockStatsObserver>());
@ -1030,6 +1075,8 @@ class PeerConnectionTestClient : public webrtc::PeerConnectionObserver,
typedef std::pair<std::string, std::string> IceUfragPwdPair;
std::map<int, IceUfragPwdPair> ice_ufrag_pwd_;
bool expect_ice_restart_ = false;
bool expect_ice_renomination_ = false;
bool expect_remote_ice_renomination_ = false;
// Needed to keep track of number of frames sent.
rtc::scoped_refptr<FakeAudioCaptureModule> fake_audio_capture_module_;
@ -2128,6 +2175,32 @@ TEST_F(P2PTestConductor, IceRestart) {
EXPECT_NE(receiver_candidate, receiver_candidate_restart);
}
TEST_F(P2PTestConductor, IceRenominationDisabled) {
config()->enable_ice_renomination = false;
ASSERT_TRUE(CreateTestClients());
LocalP2PTest();
initializing_client()->VerifyLocalIceRenomination();
receiving_client()->VerifyLocalIceRenomination();
initializing_client()->VerifyRemoteIceRenomination();
receiving_client()->VerifyRemoteIceRenomination();
}
TEST_F(P2PTestConductor, IceRenominationEnabled) {
config()->enable_ice_renomination = true;
ASSERT_TRUE(CreateTestClients());
initializing_client()->SetExpectIceRenomination(true);
initializing_client()->SetExpectRemoteIceRenomination(true);
receiving_client()->SetExpectIceRenomination(true);
receiving_client()->SetExpectRemoteIceRenomination(true);
LocalP2PTest();
initializing_client()->VerifyLocalIceRenomination();
receiving_client()->VerifyLocalIceRenomination();
initializing_client()->VerifyRemoteIceRenomination();
receiving_client()->VerifyRemoteIceRenomination();
}
// This test sets up a call between two parties with audio, and video.
// It then renegotiates setting the video m-line to "port 0", then later
// renegotiates again, enabling video.