Update talk to 54527154.
TBR=wu
Review URL: https://webrtc-codereview.appspot.com/2389004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4954 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/session/media/channel.cc b/talk/session/media/channel.cc
index e00ba16..1cb5992 100644
--- a/talk/session/media/channel.cc
+++ b/talk/session/media/channel.cc
@@ -1081,32 +1081,42 @@
return media_channel()->SetSendBandwidth(true, max_bandwidth);
}
+// |dtls| will be set to true if DTLS is active for transport channel and
+// crypto is empty.
+bool BaseChannel::CheckSrtpConfig(const std::vector<CryptoParams>& cryptos,
+ bool* dtls) {
+ *dtls = transport_channel_->IsDtlsActive();
+ if (*dtls && !cryptos.empty()) {
+ LOG(LS_WARNING) << "Cryptos must be empty when DTLS is active.";
+ return false;
+ }
+ return true;
+}
+
bool BaseChannel::SetSrtp_w(const std::vector<CryptoParams>& cryptos,
ContentAction action, ContentSource src) {
bool ret = false;
+ bool dtls = false;
+ ret = CheckSrtpConfig(cryptos, &dtls);
switch (action) {
case CA_OFFER:
- ret = srtp_filter_.SetOffer(cryptos, src);
+ // If DTLS is already active on the channel, we could be renegotiating
+ // here. We don't update the srtp filter.
+ if (ret && !dtls) {
+ ret = srtp_filter_.SetOffer(cryptos, src);
+ }
break;
case CA_PRANSWER:
// If we're doing DTLS-SRTP, we don't want to update the filter
// with an answer, because we already have SRTP parameters.
- if (transport_channel_->IsDtlsActive()) {
- LOG(LS_INFO) <<
- "Ignoring SDES answer parameters because we are using DTLS-SRTP";
- ret = true;
- } else {
+ if (ret && !dtls) {
ret = srtp_filter_.SetProvisionalAnswer(cryptos, src);
}
break;
case CA_ANSWER:
// If we're doing DTLS-SRTP, we don't want to update the filter
// with an answer, because we already have SRTP parameters.
- if (transport_channel_->IsDtlsActive()) {
- LOG(LS_INFO) <<
- "Ignoring SDES answer parameters because we are using DTLS-SRTP";
- ret = true;
- } else {
+ if (ret && !dtls) {
ret = srtp_filter_.SetAnswer(cryptos, src);
}
break;
@@ -2582,6 +2592,9 @@
ret = UpdateLocalStreams_w(data->streams(), action);
if (ret) {
set_local_content_direction(content->direction());
+ // As in SetRemoteContent_w, make sure we set the local SCTP port
+ // number as specified in our DataContentDescription.
+ ret = media_channel()->SetRecvCodecs(data->codecs());
}
} else {
ret = SetBaseLocalContent_w(content, action);
@@ -2620,6 +2633,9 @@
ret = UpdateRemoteStreams_w(content->streams(), action);
if (ret) {
set_remote_content_direction(content->direction());
+ // We send the SCTP port number (not to be confused with the underlying
+ // UDP port number) as a codec parameter. Make sure it gets there.
+ ret = media_channel()->SetSendCodecs(data->codecs());
}
} else {
// If the remote data doesn't have codecs and isn't an update, it