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

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

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: Created 3 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
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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 if (!GetValue(fields[0], kAttributeExtmap, &value_direction, error)) { 1204 if (!GetValue(fields[0], kAttributeExtmap, &value_direction, error)) {
1205 return false; 1205 return false;
1206 } 1206 }
1207 std::vector<std::string> sub_fields; 1207 std::vector<std::string> sub_fields;
1208 rtc::split(value_direction, kSdpDelimiterSlash, &sub_fields); 1208 rtc::split(value_direction, kSdpDelimiterSlash, &sub_fields);
1209 int value = 0; 1209 int value = 0;
1210 if (!GetValueFromString(line, sub_fields[0], &value, error)) { 1210 if (!GetValueFromString(line, sub_fields[0], &value, error)) {
1211 return false; 1211 return false;
1212 } 1212 }
1213 1213
1214 *extmap = RtpExtension(uri, value); 1214 bool encrypted = false;
1215 if (uri == RtpExtension::kEncryptHeaderExtensionsUri) {
1216 // RFC 6904
1217 // a=extmap:<value["/"<direction>] urn:ietf:params:rtp-hdrext:encrypt \
1218 // <URI> <extensionattributes>
1219 const size_t expected_min_fields_encrypted = expected_min_fields + 1;
1220 if (fields.size() < expected_min_fields_encrypted) {
1221 return ParseFailedExpectMinFieldNum(line, expected_min_fields_encrypted,
1222 error);
1223 }
1224
1225 encrypted = true;
1226 uri = fields[2];
1227 if (uri == RtpExtension::kEncryptHeaderExtensionsUri) {
1228 return ParseFailed(line, "Recursive encrypted header.", error);
1229 }
1230 }
1231
1232 *extmap = RtpExtension(uri, value, encrypted);
1215 return true; 1233 return true;
1216 } 1234 }
1217 1235
1218 void BuildMediaDescription(const ContentInfo* content_info, 1236 void BuildMediaDescription(const ContentInfo* content_info,
1219 const TransportInfo* transport_info, 1237 const TransportInfo* transport_info,
1220 const MediaType media_type, 1238 const MediaType media_type,
1221 const std::vector<Candidate>& candidates, 1239 const std::vector<Candidate>& candidates,
1222 bool unified_plan_sdp, 1240 bool unified_plan_sdp,
1223 std::string* message) { 1241 std::string* message) {
1224 RTC_DCHECK(message != NULL); 1242 RTC_DCHECK(message != NULL);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 void BuildRtpContentAttributes(const MediaContentDescription* media_desc, 1465 void BuildRtpContentAttributes(const MediaContentDescription* media_desc,
1448 const MediaType media_type, 1466 const MediaType media_type,
1449 bool unified_plan_sdp, 1467 bool unified_plan_sdp,
1450 std::string* message) { 1468 std::string* message) {
1451 std::ostringstream os; 1469 std::ostringstream os;
1452 // RFC 5285 1470 // RFC 5285
1453 // a=extmap:<value>["/"<direction>] <URI> <extensionattributes> 1471 // a=extmap:<value>["/"<direction>] <URI> <extensionattributes>
1454 // The definitions MUST be either all session level or all media level. This 1472 // The definitions MUST be either all session level or all media level. This
1455 // implementation uses all media level. 1473 // implementation uses all media level.
1456 for (size_t i = 0; i < media_desc->rtp_header_extensions().size(); ++i) { 1474 for (size_t i = 0; i < media_desc->rtp_header_extensions().size(); ++i) {
1475 const RtpExtension& extension = media_desc->rtp_header_extensions()[i];
1457 InitAttrLine(kAttributeExtmap, &os); 1476 InitAttrLine(kAttributeExtmap, &os);
1458 os << kSdpDelimiterColon << media_desc->rtp_header_extensions()[i].id 1477 os << kSdpDelimiterColon << extension.id;
1459 << kSdpDelimiterSpace << media_desc->rtp_header_extensions()[i].uri; 1478 if (extension.encrypted) {
1479 os << kSdpDelimiterSpace << RtpExtension::kEncryptHeaderExtensionsUri;
1480 }
1481 os << kSdpDelimiterSpace << extension.uri;
1460 AddLine(os.str(), message); 1482 AddLine(os.str(), message);
1461 } 1483 }
1462 1484
1463 // RFC 3264 1485 // RFC 3264
1464 // a=sendrecv || a=sendonly || a=sendrecv || a=inactive 1486 // a=sendrecv || a=sendonly || a=sendrecv || a=inactive
1465 switch (media_desc->direction()) { 1487 switch (media_desc->direction()) {
1466 case cricket::MD_INACTIVE: 1488 case cricket::MD_INACTIVE:
1467 InitAttrLine(kAttributeInactive, &os); 1489 InitAttrLine(kAttributeInactive, &os);
1468 break; 1490 break;
1469 case cricket::MD_SENDONLY: 1491 case cricket::MD_SENDONLY:
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after
3234 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( 3256 UpdateCodec<AudioContentDescription, cricket::AudioCodec>(
3235 media_desc, payload_type, feedback_param); 3257 media_desc, payload_type, feedback_param);
3236 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { 3258 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
3237 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( 3259 UpdateCodec<VideoContentDescription, cricket::VideoCodec>(
3238 media_desc, payload_type, feedback_param); 3260 media_desc, payload_type, feedback_param);
3239 } 3261 }
3240 return true; 3262 return true;
3241 } 3263 }
3242 3264
3243 } // namespace webrtc 3265 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698