From 61c1b8ea32d1801384151286ad8bd4eeccacf34b Mon Sep 17 00:00:00 2001 From: "buildbot@webrtc.org" Date: Wed, 9 Apr 2014 06:06:38 +0000 Subject: [PATCH] (Auto)update libjingle 64585415-> 64594651 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5870 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/app/webrtc/peerconnection_unittest.cc | 25 ++++++++-------- .../peerconnectioninterface_unittest.cc | 5 ++-- .../webrtc/test/peerconnectiontestwrapper.cc | 6 +++- talk/app/webrtc/webrtcsession.cc | 29 +++++++++++++++++-- talk/commit_message.txt | 8 +++++ talk/p2p/base/dtlstransportchannel.cc | 15 +++++----- talk/p2p/base/session.cc | 18 ++++++++---- talk/p2p/base/session.h | 13 ++++++++- 8 files changed, 86 insertions(+), 33 deletions(-) create mode 100755 talk/commit_message.txt diff --git a/talk/app/webrtc/peerconnection_unittest.cc b/talk/app/webrtc/peerconnection_unittest.cc index 0c334d14a0..4bfe083908 100644 --- a/talk/app/webrtc/peerconnection_unittest.cc +++ b/talk/app/webrtc/peerconnection_unittest.cc @@ -726,16 +726,9 @@ class JsepTestClient ice_server.uri = "stun:stun.l.google.com:19302"; ice_servers.push_back(ice_server); - // TODO(jiayl): we should always pass a FakeIdentityService so that DTLS - // is enabled by default like in Chrome (issue 2838). - FakeIdentityService* dtls_service = NULL; - bool dtls; - if (FindConstraint(constraints, - MediaConstraintsInterface::kEnableDtlsSrtp, - &dtls, - NULL) && dtls) { - dtls_service = new FakeIdentityService(); - } + FakeIdentityService* dtls_service = + talk_base::SSLStreamAdapter::HaveDtlsSrtp() ? + new FakeIdentityService() : NULL; return peer_connection_factory()->CreatePeerConnection( ice_servers, constraints, factory, dtls_service, this); } @@ -1318,9 +1311,15 @@ TEST_F(JsepPeerConnectionP2PTestClient, RegisterDataChannelObserver) { // This test sets up a call between two parties with audio, video and but only // the initiating client support data. TEST_F(JsepPeerConnectionP2PTestClient, LocalP2PTestReceiverDoesntSupportData) { - FakeConstraints setup_constraints; - setup_constraints.SetAllowRtpDataChannels(); - ASSERT_TRUE(CreateTestClients(&setup_constraints, NULL)); + FakeConstraints setup_constraints_1; + setup_constraints_1.SetAllowRtpDataChannels(); + // Must disable DTLS to make negotiation succeed. + setup_constraints_1.SetMandatory( + MediaConstraintsInterface::kEnableDtlsSrtp, false); + FakeConstraints setup_constraints_2; + setup_constraints_2.SetMandatory( + MediaConstraintsInterface::kEnableDtlsSrtp, false); + ASSERT_TRUE(CreateTestClients(&setup_constraints_1, &setup_constraints_2)); initializing_client()->CreateDataChannel(); LocalP2PTest(); EXPECT_TRUE(initializing_client()->data_channel() != NULL); diff --git a/talk/app/webrtc/peerconnectioninterface_unittest.cc b/talk/app/webrtc/peerconnectioninterface_unittest.cc index 97a4176df1..a69bfa0da0 100644 --- a/talk/app/webrtc/peerconnectioninterface_unittest.cc +++ b/talk/app/webrtc/peerconnectioninterface_unittest.cc @@ -259,8 +259,9 @@ class PeerConnectionInterfaceTest : public testing::Test { port_allocator_factory_ = FakePortAllocatorFactory::Create(); - // TODO(jiayl): we should always pass a FakeIdentityService so that DTLS - // is enabled by default like in Chrome (issue 2838). + // DTLS does not work in a loopback call, so is disabled for most of the + // tests in this file. We only create a FakeIdentityService if the test + // explicitly sets the constraint. FakeIdentityService* dtls_service = NULL; bool dtls; if (FindConstraint(constraints, diff --git a/talk/app/webrtc/test/peerconnectiontestwrapper.cc b/talk/app/webrtc/test/peerconnectiontestwrapper.cc index ca4b6d2f9b..d7c30a82d8 100644 --- a/talk/app/webrtc/test/peerconnectiontestwrapper.cc +++ b/talk/app/webrtc/test/peerconnectiontestwrapper.cc @@ -26,6 +26,7 @@ */ #include "talk/app/webrtc/fakeportallocatorfactory.h" +#include "talk/app/webrtc/test/fakedtlsidentityservice.h" #include "talk/app/webrtc/test/fakeperiodicvideocapturer.h" #include "talk/app/webrtc/test/mockpeerconnectionobservers.h" #include "talk/app/webrtc/test/peerconnectiontestwrapper.h" @@ -93,8 +94,11 @@ bool PeerConnectionTestWrapper::CreatePc( webrtc::PeerConnectionInterface::IceServer ice_server; ice_server.uri = "stun:stun.l.google.com:19302"; ice_servers.push_back(ice_server); + FakeIdentityService* dtls_service = + talk_base::SSLStreamAdapter::HaveDtlsSrtp() ? + new FakeIdentityService() : NULL; peer_connection_ = peer_connection_factory_->CreatePeerConnection( - ice_servers, constraints, allocator_factory_.get(), NULL, this); + ice_servers, constraints, allocator_factory_.get(), dtls_service, this); return peer_connection_.get() != NULL; } diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc index 62276f08c3..63aca36449 100644 --- a/talk/app/webrtc/webrtcsession.cc +++ b/talk/app/webrtc/webrtcsession.cc @@ -882,9 +882,32 @@ bool WebRtcSession::ProcessIceMessage(const IceCandidateInterface* candidate) { return false; } - if (!local_description() || !remote_description()) { - LOG(LS_INFO) << "ProcessIceMessage: Remote description not set, " - << "save the candidate for later use."; + cricket::TransportProxy* transport_proxy = NULL; + if (remote_description()) { + size_t mediacontent_index = + static_cast(candidate->sdp_mline_index()); + size_t remote_content_size = + BaseSession::remote_description()->contents().size(); + if (mediacontent_index >= remote_content_size) { + LOG(LS_ERROR) + << "ProcessIceMessage: Invalid candidate media index."; + return false; + } + + cricket::ContentInfo content = + BaseSession::remote_description()->contents()[mediacontent_index]; + transport_proxy = GetTransportProxy(content.name); + } + + // We need to check the local/remote description for the Transport instead of + // the session, because a new Transport added during renegotiation may have + // them unset while the session has them set from the previou negotiation. Not + // doing so may trigger the auto generation of transport description and mess + // up DTLS identity information, ICE credential, etc. + if (!transport_proxy || !(transport_proxy->local_description_set() && + transport_proxy->remote_description_set())) { + LOG(LS_INFO) << "ProcessIceMessage: Local/Remote description not set " + << "on the Transport, save the candidate for later use."; saved_candidates_.push_back( new JsepIceCandidate(candidate->sdp_mid(), candidate->sdp_mline_index(), candidate->candidate())); diff --git a/talk/commit_message.txt b/talk/commit_message.txt new file mode 100755 index 0000000000..117720043f --- /dev/null +++ b/talk/commit_message.txt @@ -0,0 +1,8 @@ +Change 64504440 updated. +Starting METADATA Presubmit checks ... +Spawned CheckCopyright (//depot/METADATA) +Success: CheckCopyright (5.25 us) +Presubmit checks finished with: + 0 errors; 0 warnings; 0 notices. +Change 64504440 updated. +Reverting any unchanged files. diff --git a/talk/p2p/base/dtlstransportchannel.cc b/talk/p2p/base/dtlstransportchannel.cc index 30cd80e70b..318ba9422e 100644 --- a/talk/p2p/base/dtlstransportchannel.cc +++ b/talk/p2p/base/dtlstransportchannel.cc @@ -156,14 +156,15 @@ void DtlsTransportChannelWrapper::Reset() { bool DtlsTransportChannelWrapper::SetLocalIdentity( talk_base::SSLIdentity* identity) { - if (dtls_state_ == STATE_OPEN && identity == local_identity_) { - return true; - } - - // TODO(ekr@rtfm.com): Forbid this if Connect() has been called. if (dtls_state_ != STATE_NONE) { - LOG_J(LS_ERROR, this) << "Can't set DTLS local identity in this state"; - return false; + if (identity == local_identity_) { + // This may happen during renegotiation. + LOG_J(LS_INFO, this) << "Ignoring identical DTLS identity"; + return true; + } else { + LOG_J(LS_ERROR, this) << "Can't change DTLS local identity in this state"; + return false; + } } if (identity) { diff --git a/talk/p2p/base/session.cc b/talk/p2p/base/session.cc index 3520984339..a48f3cb0f6 100644 --- a/talk/p2p/base/session.cc +++ b/talk/p2p/base/session.cc @@ -284,9 +284,12 @@ bool TransportProxy::SetLocalTransportDescription( if (action == CA_ANSWER) { CompleteNegotiation(); } - return transport_->get()->SetLocalTransportDescription(description, - action, - error_desc); + bool result = transport_->get()->SetLocalTransportDescription(description, + action, + error_desc); + if (result) + local_description_set_ = true; + return result; } bool TransportProxy::SetRemoteTransportDescription( @@ -297,9 +300,12 @@ bool TransportProxy::SetRemoteTransportDescription( if (action == CA_ANSWER) { CompleteNegotiation(); } - return transport_->get()->SetRemoteTransportDescription(description, - action, - error_desc); + bool result = transport_->get()->SetRemoteTransportDescription(description, + action, + error_desc); + if (result) + remote_description_set_ = true; + return result; } void TransportProxy::OnSignalingReady() { diff --git a/talk/p2p/base/session.h b/talk/p2p/base/session.h index 826baaa5fb..504187f621 100644 --- a/talk/p2p/base/session.h +++ b/talk/p2p/base/session.h @@ -102,7 +102,9 @@ class TransportProxy : public sigslot::has_slots<>, connecting_(false), negotiated_(false), sent_candidates_(false), - candidates_allocated_(false) { + candidates_allocated_(false), + local_description_set_(false), + remote_description_set_(false) { transport_->get()->SignalCandidatesReady.connect( this, &TransportProxy::OnTransportCandidatesReady); } @@ -165,6 +167,13 @@ class TransportProxy : public sigslot::has_slots<>, SignalCandidatesReady(this, candidates); } + bool local_description_set() const { + return local_description_set_; + } + bool remote_description_set() const { + return remote_description_set_; + } + // Handles sending of ready candidates and receiving of remote candidates. sigslot::signal2&> SignalCandidatesReady; @@ -196,6 +205,8 @@ class TransportProxy : public sigslot::has_slots<>, Candidates sent_candidates_; Candidates unsent_candidates_; bool candidates_allocated_; + bool local_description_set_; + bool remote_description_set_; }; typedef std::map TransportMap;