Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: talk/session/media/mediasession.cc

Issue 1219333002: Use "UDP/TLS/RTP/SAVPF" profile in offer when DTLS-SRTP is used. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing some unit tests to account for new behavior Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 using rtc::scoped_ptr; 57 using rtc::scoped_ptr;
58 58
59 // RTP Profile names 59 // RTP Profile names
60 // http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xml 60 // http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xml
61 // RFC4585 61 // RFC4585
62 const char kMediaProtocolAvpf[] = "RTP/AVPF"; 62 const char kMediaProtocolAvpf[] = "RTP/AVPF";
63 // RFC5124 63 // RFC5124
64 const char kMediaProtocolDtlsSavpf[] = "UDP/TLS/RTP/SAVPF"; 64 const char kMediaProtocolDtlsSavpf[] = "UDP/TLS/RTP/SAVPF";
65 65
66 // This should be replaced by "UDP/TLS/RTP/SAVPF", but we need to support it for 66 // We always generate offers with "UDP/TLS/RTP/SAVPF" when using DTLS-SRTP,
67 // now to be compatible with previous Chrome versions. 67 // but we tolerate "RTP/SAVPF" in offers we receive, for compatibility.
68 const char kMediaProtocolSavpf[] = "RTP/SAVPF"; 68 const char kMediaProtocolSavpf[] = "RTP/SAVPF";
69 69
70 const char kMediaProtocolRtpPrefix[] = "RTP/"; 70 const char kMediaProtocolRtpPrefix[] = "RTP/";
71 71
72 const char kMediaProtocolSctp[] = "SCTP"; 72 const char kMediaProtocolSctp[] = "SCTP";
73 const char kMediaProtocolDtlsSctp[] = "DTLS/SCTP"; 73 const char kMediaProtocolDtlsSctp[] = "DTLS/SCTP";
74 const char kMediaProtocolUdpDtlsSctp[] = "UDP/DTLS/SCTP"; 74 const char kMediaProtocolUdpDtlsSctp[] = "UDP/DTLS/SCTP";
75 const char kMediaProtocolTcpDtlsSctp[] = "TCP/DTLS/SCTP"; 75 const char kMediaProtocolTcpDtlsSctp[] = "TCP/DTLS/SCTP";
76 76
77 static bool IsMediaContentOfType(const ContentInfo* content, 77 static bool IsMediaContentOfType(const ContentInfo* content,
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 const std::string& content_name) { 607 const std::string& content_name) {
608 bool is_rtp = false; 608 bool is_rtp = false;
609 ContentInfo* content = sdesc->GetContentByName(content_name); 609 ContentInfo* content = sdesc->GetContentByName(content_name);
610 if (IsMediaContent(content)) { 610 if (IsMediaContent(content)) {
611 MediaContentDescription* media_desc = 611 MediaContentDescription* media_desc =
612 static_cast<MediaContentDescription*>(content->description); 612 static_cast<MediaContentDescription*>(content->description);
613 if (!media_desc) { 613 if (!media_desc) {
614 return false; 614 return false;
615 } 615 }
616 is_rtp = media_desc->protocol().empty() || 616 is_rtp = media_desc->protocol().empty() ||
617 rtc::starts_with(media_desc->protocol().data(), 617 (media_desc->protocol().find(cricket::kMediaProtocolRtpPrefix) !=
618 kMediaProtocolRtpPrefix); 618 std::string::npos);
619 } 619 }
620 return is_rtp; 620 return is_rtp;
621 } 621 }
622 622
623 // Updates the crypto parameters of the |sdesc| according to the given 623 // Updates the crypto parameters of the |sdesc| according to the given
624 // |bundle_group|. The crypto parameters of all the contents within the 624 // |bundle_group|. The crypto parameters of all the contents within the
625 // |bundle_group| should be updated to use the common subset of the 625 // |bundle_group| should be updated to use the common subset of the
626 // available cryptos. 626 // available cryptos.
627 static bool UpdateCryptoParamsForBundle(const ContentGroup& bundle_group, 627 static bool UpdateCryptoParamsForBundle(const ContentGroup& bundle_group,
628 SessionDescription* sdesc) { 628 SessionDescription* sdesc) {
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 1040
1041 // Since not all applications serialize and deserialize the media protocol, 1041 // Since not all applications serialize and deserialize the media protocol,
1042 // we will have to accept |protocol| to be empty. 1042 // we will have to accept |protocol| to be empty.
1043 return protocol == kMediaProtocolAvpf || protocol.empty() || 1043 return protocol == kMediaProtocolAvpf || protocol.empty() ||
1044 protocol == kMediaProtocolSavpf || 1044 protocol == kMediaProtocolSavpf ||
1045 (protocol == kMediaProtocolDtlsSavpf && secure_transport); 1045 (protocol == kMediaProtocolDtlsSavpf && secure_transport);
1046 } 1046 }
1047 1047
1048 static void SetMediaProtocol(bool secure_transport, 1048 static void SetMediaProtocol(bool secure_transport,
1049 MediaContentDescription* desc) { 1049 MediaContentDescription* desc) {
1050 if (!desc->cryptos().empty() || secure_transport) 1050 if (!desc->cryptos().empty())
1051 desc->set_protocol(kMediaProtocolSavpf); 1051 desc->set_protocol(kMediaProtocolSavpf);
1052 else if (secure_transport)
1053 desc->set_protocol(kMediaProtocolDtlsSavpf);
1052 else 1054 else
1053 desc->set_protocol(kMediaProtocolAvpf); 1055 desc->set_protocol(kMediaProtocolAvpf);
1054 } 1056 }
1055 1057
1056 // Gets the TransportInfo of the given |content_name| from the 1058 // Gets the TransportInfo of the given |content_name| from the
1057 // |current_description|. If doesn't exist, returns a new one. 1059 // |current_description|. If doesn't exist, returns a new one.
1058 static const TransportDescription* GetTransportDescription( 1060 static const TransportDescription* GetTransportDescription(
1059 const std::string& content_name, 1061 const std::string& content_name,
1060 const SessionDescription* current_description) { 1062 const SessionDescription* current_description) {
1061 const TransportDescription* desc = NULL; 1063 const TransportDescription* desc = NULL;
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 } else if (channel_name == GICE_CHANNEL_NAME_DATA_RTP || 1947 } else if (channel_name == GICE_CHANNEL_NAME_DATA_RTP ||
1946 channel_name == GICE_CHANNEL_NAME_DATA_RTCP) { 1948 channel_name == GICE_CHANNEL_NAME_DATA_RTCP) {
1947 *media_type = MEDIA_TYPE_DATA; 1949 *media_type = MEDIA_TYPE_DATA;
1948 return true; 1950 return true;
1949 } 1951 }
1950 1952
1951 return false; 1953 return false;
1952 } 1954 }
1953 1955
1954 } // namespace cricket 1956 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/app/webrtc/webrtcsession_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698