OLD | NEW |
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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 if (!GetValue(fields[0], kAttributeExtmap, &value_direction, error)) { | 1169 if (!GetValue(fields[0], kAttributeExtmap, &value_direction, error)) { |
1170 return false; | 1170 return false; |
1171 } | 1171 } |
1172 std::vector<std::string> sub_fields; | 1172 std::vector<std::string> sub_fields; |
1173 rtc::split(value_direction, kSdpDelimiterSlash, &sub_fields); | 1173 rtc::split(value_direction, kSdpDelimiterSlash, &sub_fields); |
1174 int value = 0; | 1174 int value = 0; |
1175 if (!GetValueFromString(line, sub_fields[0], &value, error)) { | 1175 if (!GetValueFromString(line, sub_fields[0], &value, error)) { |
1176 return false; | 1176 return false; |
1177 } | 1177 } |
1178 | 1178 |
1179 *extmap = RtpExtension(uri, value); | 1179 bool encrypted = false; |
| 1180 if (uri == RtpExtension::kEncryptHeaderExtensionsUri) { |
| 1181 // RFC 6904 |
| 1182 // a=extmap:<value["/"<direction>] urn:ietf:params:rtp-hdrext:encrypt \ |
| 1183 // <URI> <extensionattributes> |
| 1184 const size_t expected_min_fields_encrypted = expected_min_fields + 1; |
| 1185 if (fields.size() < expected_min_fields_encrypted) { |
| 1186 return ParseFailedExpectMinFieldNum(line, expected_min_fields_encrypted, |
| 1187 error); |
| 1188 } |
| 1189 |
| 1190 encrypted = true; |
| 1191 uri = fields[2]; |
| 1192 if (uri == RtpExtension::kEncryptHeaderExtensionsUri) { |
| 1193 return ParseFailed(line, "Recursive encrypted header.", error); |
| 1194 } |
| 1195 } |
| 1196 |
| 1197 *extmap = RtpExtension(uri, value, encrypted); |
1180 return true; | 1198 return true; |
1181 } | 1199 } |
1182 | 1200 |
1183 void BuildMediaDescription(const ContentInfo* content_info, | 1201 void BuildMediaDescription(const ContentInfo* content_info, |
1184 const TransportInfo* transport_info, | 1202 const TransportInfo* transport_info, |
1185 const MediaType media_type, | 1203 const MediaType media_type, |
1186 const std::vector<Candidate>& candidates, | 1204 const std::vector<Candidate>& candidates, |
1187 bool unified_plan_sdp, | 1205 bool unified_plan_sdp, |
1188 std::string* message) { | 1206 std::string* message) { |
1189 RTC_DCHECK(message != NULL); | 1207 RTC_DCHECK(message != NULL); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 void BuildRtpContentAttributes(const MediaContentDescription* media_desc, | 1444 void BuildRtpContentAttributes(const MediaContentDescription* media_desc, |
1427 const MediaType media_type, | 1445 const MediaType media_type, |
1428 bool unified_plan_sdp, | 1446 bool unified_plan_sdp, |
1429 std::string* message) { | 1447 std::string* message) { |
1430 std::ostringstream os; | 1448 std::ostringstream os; |
1431 // RFC 5285 | 1449 // RFC 5285 |
1432 // a=extmap:<value>["/"<direction>] <URI> <extensionattributes> | 1450 // a=extmap:<value>["/"<direction>] <URI> <extensionattributes> |
1433 // The definitions MUST be either all session level or all media level. This | 1451 // The definitions MUST be either all session level or all media level. This |
1434 // implementation uses all media level. | 1452 // implementation uses all media level. |
1435 for (size_t i = 0; i < media_desc->rtp_header_extensions().size(); ++i) { | 1453 for (size_t i = 0; i < media_desc->rtp_header_extensions().size(); ++i) { |
| 1454 const RtpExtension& extension = media_desc->rtp_header_extensions()[i]; |
1436 InitAttrLine(kAttributeExtmap, &os); | 1455 InitAttrLine(kAttributeExtmap, &os); |
1437 os << kSdpDelimiterColon << media_desc->rtp_header_extensions()[i].id | 1456 os << kSdpDelimiterColon << extension.id; |
1438 << kSdpDelimiterSpace << media_desc->rtp_header_extensions()[i].uri; | 1457 if (extension.encrypt) { |
| 1458 os << kSdpDelimiterSpace << RtpExtension::kEncryptHeaderExtensionsUri; |
| 1459 } |
| 1460 os << kSdpDelimiterSpace << extension.uri; |
1439 AddLine(os.str(), message); | 1461 AddLine(os.str(), message); |
1440 } | 1462 } |
1441 | 1463 |
1442 // RFC 3264 | 1464 // RFC 3264 |
1443 // a=sendrecv || a=sendonly || a=sendrecv || a=inactive | 1465 // a=sendrecv || a=sendonly || a=sendrecv || a=inactive |
1444 switch (media_desc->direction()) { | 1466 switch (media_desc->direction()) { |
1445 case cricket::MD_INACTIVE: | 1467 case cricket::MD_INACTIVE: |
1446 InitAttrLine(kAttributeInactive, &os); | 1468 InitAttrLine(kAttributeInactive, &os); |
1447 break; | 1469 break; |
1448 case cricket::MD_SENDONLY: | 1470 case cricket::MD_SENDONLY: |
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3293 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3315 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3294 media_desc, payload_type, feedback_param); | 3316 media_desc, payload_type, feedback_param); |
3295 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3317 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3296 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3318 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3297 media_desc, payload_type, feedback_param); | 3319 media_desc, payload_type, feedback_param); |
3298 } | 3320 } |
3299 return true; | 3321 return true; |
3300 } | 3322 } |
3301 | 3323 |
3302 } // namespace webrtc | 3324 } // namespace webrtc |
OLD | NEW |