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

Side by Side Diff: webrtc/api/webrtcsdp.cc

Issue 1815473002: Add 16-bit network id to the candidate signaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Remove the old NETWORK_COST attribute. Created 4 years, 9 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 | « no previous file | webrtc/api/webrtcsdp_unittest.cc » ('j') | 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 * Copyright 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 static const char kSSrcAttributeLabel[] = "label"; 120 static const char kSSrcAttributeLabel[] = "label";
121 static const char kAttributeSsrcGroup[] = "ssrc-group"; 121 static const char kAttributeSsrcGroup[] = "ssrc-group";
122 static const char kAttributeCrypto[] = "crypto"; 122 static const char kAttributeCrypto[] = "crypto";
123 static const char kAttributeCandidate[] = "candidate"; 123 static const char kAttributeCandidate[] = "candidate";
124 static const char kAttributeCandidateTyp[] = "typ"; 124 static const char kAttributeCandidateTyp[] = "typ";
125 static const char kAttributeCandidateRaddr[] = "raddr"; 125 static const char kAttributeCandidateRaddr[] = "raddr";
126 static const char kAttributeCandidateRport[] = "rport"; 126 static const char kAttributeCandidateRport[] = "rport";
127 static const char kAttributeCandidateUfrag[] = "ufrag"; 127 static const char kAttributeCandidateUfrag[] = "ufrag";
128 static const char kAttributeCandidatePwd[] = "pwd"; 128 static const char kAttributeCandidatePwd[] = "pwd";
129 static const char kAttributeCandidateGeneration[] = "generation"; 129 static const char kAttributeCandidateGeneration[] = "generation";
130 static const char kAttributeCandidateNetworkId[] = "network-id";
130 static const char kAttributeCandidateNetworkCost[] = "network-cost"; 131 static const char kAttributeCandidateNetworkCost[] = "network-cost";
131 static const char kAttributeFingerprint[] = "fingerprint"; 132 static const char kAttributeFingerprint[] = "fingerprint";
132 static const char kAttributeSetup[] = "setup"; 133 static const char kAttributeSetup[] = "setup";
133 static const char kAttributeFmtp[] = "fmtp"; 134 static const char kAttributeFmtp[] = "fmtp";
134 static const char kAttributeRtpmap[] = "rtpmap"; 135 static const char kAttributeRtpmap[] = "rtpmap";
135 static const char kAttributeSctpmap[] = "sctpmap"; 136 static const char kAttributeSctpmap[] = "sctpmap";
136 static const char kAttributeRtcp[] = "rtcp"; 137 static const char kAttributeRtcp[] = "rtcp";
137 static const char kAttributeIceUfrag[] = "ice-ufrag"; 138 static const char kAttributeIceUfrag[] = "ice-ufrag";
138 static const char kAttributeIcePwd[] = "ice-pwd"; 139 static const char kAttributeIcePwd[] = "ice-pwd";
139 static const char kAttributeIceLite[] = "ice-lite"; 140 static const char kAttributeIceLite[] = "ice-lite";
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 } 1086 }
1086 } 1087 }
1087 1088
1088 // Extension 1089 // Extension
1089 // Though non-standard, we support the ICE ufrag and pwd being signaled on 1090 // Though non-standard, we support the ICE ufrag and pwd being signaled on
1090 // the candidate to avoid issues with confusing which generation a candidate 1091 // the candidate to avoid issues with confusing which generation a candidate
1091 // belongs to when trickling multiple generations at the same time. 1092 // belongs to when trickling multiple generations at the same time.
1092 std::string username; 1093 std::string username;
1093 std::string password; 1094 std::string password;
1094 uint32_t generation = 0; 1095 uint32_t generation = 0;
1095 uint32_t network_cost = 0; 1096 uint16_t network_id = 0;
1097 uint16_t network_cost = 0;
1096 for (size_t i = current_position; i + 1 < fields.size(); ++i) { 1098 for (size_t i = current_position; i + 1 < fields.size(); ++i) {
1097 // RFC 5245 1099 // RFC 5245
1098 // *(SP extension-att-name SP extension-att-value) 1100 // *(SP extension-att-name SP extension-att-value)
1099 if (fields[i] == kAttributeCandidateGeneration) { 1101 if (fields[i] == kAttributeCandidateGeneration) {
1100 if (!GetValueFromString(first_line, fields[++i], &generation, error)) { 1102 if (!GetValueFromString(first_line, fields[++i], &generation, error)) {
1101 return false; 1103 return false;
1102 } 1104 }
1103 } else if (fields[i] == kAttributeCandidateUfrag) { 1105 } else if (fields[i] == kAttributeCandidateUfrag) {
1104 username = fields[++i]; 1106 username = fields[++i];
1105 } else if (fields[i] == kAttributeCandidatePwd) { 1107 } else if (fields[i] == kAttributeCandidatePwd) {
1106 password = fields[++i]; 1108 password = fields[++i];
1109 } else if (fields[i] == kAttributeCandidateNetworkId) {
1110 if (!GetValueFromString(first_line, fields[++i], &network_id, error)) {
1111 return false;
1112 }
1107 } else if (fields[i] == kAttributeCandidateNetworkCost) { 1113 } else if (fields[i] == kAttributeCandidateNetworkCost) {
1108 if (!GetValueFromString(first_line, fields[++i], &network_cost, error)) { 1114 if (!GetValueFromString(first_line, fields[++i], &network_cost, error)) {
1109 return false; 1115 return false;
1110 } 1116 }
1117 network_cost = std::min(network_cost, cricket::kMaxNetworkCost);
1111 } else { 1118 } else {
1112 // Skip the unknown extension. 1119 // Skip the unknown extension.
1113 ++i; 1120 ++i;
1114 } 1121 }
1115 } 1122 }
1116 1123
1117 *candidate = Candidate(component_id, cricket::ProtoToString(protocol), 1124 *candidate = Candidate(component_id, cricket::ProtoToString(protocol),
1118 address, priority, username, password, candidate_type, 1125 address, priority, username, password, candidate_type,
1119 generation, foundation); 1126 generation, foundation, network_id, network_cost);
1120 candidate->set_related_address(related_address); 1127 candidate->set_related_address(related_address);
1121 candidate->set_tcptype(tcptype); 1128 candidate->set_tcptype(tcptype);
1122 candidate->set_network_cost(std::min(network_cost, cricket::kMaxNetworkCost));
1123 return true; 1129 return true;
1124 } 1130 }
1125 1131
1126 bool ParseIceOptions(const std::string& line, 1132 bool ParseIceOptions(const std::string& line,
1127 std::vector<std::string>* transport_options, 1133 std::vector<std::string>* transport_options,
1128 SdpParseError* error) { 1134 SdpParseError* error) {
1129 std::string ice_options; 1135 std::string ice_options;
1130 if (!GetValue(line, kAttributeIceOption, &ice_options, error)) { 1136 if (!GetValue(line, kAttributeIceOption, &ice_options, error)) {
1131 return false; 1137 return false;
1132 } 1138 }
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1807 1813
1808 if (it->protocol() == cricket::TCP_PROTOCOL_NAME) { 1814 if (it->protocol() == cricket::TCP_PROTOCOL_NAME) {
1809 os << kTcpCandidateType << " " << it->tcptype() << " "; 1815 os << kTcpCandidateType << " " << it->tcptype() << " ";
1810 } 1816 }
1811 1817
1812 // Extensions 1818 // Extensions
1813 os << kAttributeCandidateGeneration << " " << it->generation(); 1819 os << kAttributeCandidateGeneration << " " << it->generation();
1814 if (include_ufrag && !it->username().empty()) { 1820 if (include_ufrag && !it->username().empty()) {
1815 os << " " << kAttributeCandidateUfrag << " " << it->username(); 1821 os << " " << kAttributeCandidateUfrag << " " << it->username();
1816 } 1822 }
1823 if (it->network_id() > 0) {
1824 os << " " << kAttributeCandidateNetworkId << " " << it->network_id();
1825 }
1817 if (it->network_cost() > 0) { 1826 if (it->network_cost() > 0) {
1818 os << " " << kAttributeCandidateNetworkCost << " " << it->network_cost(); 1827 os << " " << kAttributeCandidateNetworkCost << " " << it->network_cost();
1819 } 1828 }
1820 1829
1821 AddLine(os.str(), message); 1830 AddLine(os.str(), message);
1822 } 1831 }
1823 } 1832 }
1824 1833
1825 void BuildIceOptions(const std::vector<std::string>& transport_options, 1834 void BuildIceOptions(const std::vector<std::string>& transport_options,
1826 std::string* message) { 1835 std::string* message) {
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( 3156 UpdateCodec<AudioContentDescription, cricket::AudioCodec>(
3148 media_desc, payload_type, feedback_param); 3157 media_desc, payload_type, feedback_param);
3149 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { 3158 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
3150 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( 3159 UpdateCodec<VideoContentDescription, cricket::VideoCodec>(
3151 media_desc, payload_type, feedback_param); 3160 media_desc, payload_type, feedback_param);
3152 } 3161 }
3153 return true; 3162 return true;
3154 } 3163 }
3155 3164
3156 } // namespace webrtc 3165 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/webrtcsdp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698