(Auto)update libjingle 62713454-> 62865357

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5670 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrike@webrtc.org 2014-03-10 15:53:12 +00:00
parent 4a47be0f52
commit 0537634154
7 changed files with 31 additions and 38 deletions

View File

@ -1159,23 +1159,8 @@ void WebRtcSession::OnTransportConnecting(cricket::Transport* transport) {
void WebRtcSession::OnTransportWritable(cricket::Transport* transport) {
ASSERT(signaling_thread()->IsCurrent());
// TODO(bemasc): Expose more API from Transport to detect when
// candidate selection starts or stops, due to success or failure.
if (transport->all_channels_writable()) {
// By the time |SignalTransportWritable| arrives, the excess channels may
// already have been pruned, so that the Transport is Completed. The
// specification requires that transitions from Checking to Completed pass
// through Connected. This check enforces that requirement.
// (Direct transitions from Connected and Disconnected to Completed are
// allowed.)
if (ice_connection_state_ ==
PeerConnectionInterface::kIceConnectionChecking) {
SetIceConnectionState(PeerConnectionInterface::kIceConnectionConnected);
}
SetIceConnectionState(transport->completed() ?
PeerConnectionInterface::kIceConnectionCompleted :
PeerConnectionInterface::kIceConnectionConnected);
SetIceConnectionState(PeerConnectionInterface::kIceConnectionConnected);
} else if (transport->HasChannels()) {
// If the current state is Connected or Completed, then there were writable
// channels but now there are not, so the next state must be Disconnected.

View File

@ -497,6 +497,8 @@ void Transport::OnChannelReadableState_s() {
void Transport::OnChannelWritableState(TransportChannel* channel) {
ASSERT(worker_thread()->IsCurrent());
signaling_thread()->Post(this, MSG_WRITESTATE, NULL);
MaybeCompleted_w();
}
void Transport::OnChannelWritableState_s() {
@ -612,6 +614,8 @@ void Transport::OnChannelCandidatesAllocationDone(
return;
}
signaling_thread_->Post(this, MSG_CANDIDATEALLOCATIONCOMPLETE);
MaybeCompleted_w();
}
void Transport::OnChannelCandidatesAllocationDone_s() {
@ -626,15 +630,17 @@ void Transport::OnRoleConflict(TransportChannelImpl* channel) {
void Transport::OnChannelConnectionRemoved(TransportChannelImpl* channel) {
ASSERT(worker_thread()->IsCurrent());
// Determine if the Transport should move to Completed or Failed. These
// states are only available in the Controlling ICE role.
MaybeCompleted_w();
// Check if the state is now Failed.
// Failed is only available in the Controlling ICE role.
if (channel->GetIceRole() != ICEROLE_CONTROLLING) {
return;
}
ChannelMap::iterator iter = channels_.find(channel->component());
ASSERT(iter != channels_.end());
// Completed and Failed can only occur after candidate allocation has stopped.
// Failed can only occur after candidate allocation has stopped.
if (!iter->second.candidates_allocated()) {
return;
}
@ -644,28 +650,27 @@ void Transport::OnChannelConnectionRemoved(TransportChannelImpl* channel) {
// A Transport has failed if any of its channels have no remaining
// connections.
signaling_thread_->Post(this, MSG_FAILED);
} else if (connections == 1 && completed()) {
signaling_thread_->Post(this, MSG_COMPLETED);
}
}
bool Transport::completed() const {
void Transport::MaybeCompleted_w() {
ASSERT(worker_thread()->IsCurrent());
// A Transport's ICE process is completed if all of its channels are writable,
// have finished allocating candidates, and have pruned all but one of their
// connections.
if (!all_channels_writable())
return false;
ChannelMap::const_iterator iter;
for (iter = channels_.begin(); iter != channels_.end(); ++iter) {
const TransportChannelImpl* channel = iter->second.get();
if (!(channel->GetConnectionCount() == 1 &&
if (!(channel->writable() &&
channel->GetConnectionCount() == 1 &&
channel->GetIceRole() == ICEROLE_CONTROLLING &&
iter->second.candidates_allocated())) {
return false;
return;
}
}
return true;
signaling_thread_->Post(this, MSG_COMPLETED);
}
void Transport::SetIceRole_w(IceRole role) {

View File

@ -236,8 +236,6 @@ class Transport : public talk_base::MessageHandler,
}
sigslot::signal1<Transport*> SignalReadableState;
sigslot::signal1<Transport*> SignalWritableState;
bool completed() const;
sigslot::signal1<Transport*> SignalCompleted;
sigslot::signal1<Transport*> SignalFailed;
@ -488,6 +486,8 @@ class Transport : public talk_base::MessageHandler,
bool GetStats_w(TransportStats* infos);
bool GetRemoteCertificate_w(talk_base::SSLCertificate** cert);
// Sends SignalCompleted if we are now in that state.
void MaybeCompleted_w();
talk_base::Thread* signaling_thread_;
talk_base::Thread* worker_thread_;

View File

@ -206,21 +206,18 @@ TEST_F(TransportTest, TestChannelCompletedAndFailed) {
EXPECT_TRUE_WAIT(transport_->all_channels_writable(), 100);
// ICE is not yet completed because there is still more than one connection.
EXPECT_FALSE(completed_);
EXPECT_FALSE(transport_->completed());
EXPECT_FALSE(failed_);
// When the connection count drops to 1, SignalCompleted should be emitted,
// and completed() should be true.
channel_->SetConnectionCount(1);
EXPECT_TRUE_WAIT(completed_, 100);
EXPECT_TRUE(transport_->completed());
completed_ = false;
// When the connection count drops to 0, SignalFailed should be emitted, and
// completed() should be false.
channel_->SetConnectionCount(0);
EXPECT_TRUE_WAIT(failed_, 100);
EXPECT_FALSE(transport_->completed());
EXPECT_FALSE(completed_);
}

View File

@ -465,8 +465,6 @@ bool BaseChannel::SendPacket(bool rtcp, talk_base::Buffer* packet,
}
talk_base::PacketOptions options(dscp);
options.packet_time_params.rtp_sendtime_extension_id =
rtp_abs_sendtime_extn_id_;
// Protect if needed.
if (srtp_filter_.IsActive()) {
bool res;
@ -482,6 +480,8 @@ bool BaseChannel::SendPacket(bool rtcp, talk_base::Buffer* packet,
res = srtp_filter_.ProtectRtp(
data, len, static_cast<int>(packet->capacity()), &len);
#else
options.packet_time_params.rtp_sendtime_extension_id =
rtp_abs_sendtime_extn_id_;
res = srtp_filter_.ProtectRtp(
data, len, static_cast<int>(packet->capacity()), &len,
&options.packet_time_params.srtp_packet_index);

View File

@ -620,7 +620,8 @@ bool SrtpSession::GetSendStreamPacketIndex(void* p, int in_len, int64* index) {
if (stream == NULL)
return false;
*index = rdbx_get_packet_index(&stream->rtp_rdbx);
// Shift packet index, put into network byte order
*index = be64_to_cpu(rdbx_get_packet_index(&stream->rtp_rdbx) << 16);
return true;
}
@ -671,7 +672,10 @@ bool SrtpSession::SetKey(int type, const std::string& cs,
// We want to set this option only for rtp packets.
// By default policy structure is initialized to HMAC_SHA1.
#if defined(ENABLE_EXTERNAL_AUTH)
policy.rtp.auth_type = EXTERNAL_HMAC_SHA1;
// Enable external HMAC authentication only for outgoing streams.
if (type == ssrc_any_outbound) {
policy.rtp.auth_type = EXTERNAL_HMAC_SHA1;
}
#endif
policy.next = NULL;

View File

@ -631,7 +631,9 @@ TEST_F(SrtpSessionTest, TestGetSendStreamPacketIndex) {
int out_len = 0;
EXPECT_TRUE(s1_.ProtectRtp(rtp_packet_, rtp_len_,
sizeof(rtp_packet_), &out_len, &index));
EXPECT_EQ(1, index);
// |index| will be shifted by 16.
int64 be64_index = be64_to_cpu(1 << 16);
EXPECT_EQ(be64_index, index);
}
// Test that we fail to unprotect if someone tampers with the RTP/RTCP paylaods.