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

Side by Side Diff: talk/app/webrtc/webrtcsdp.cc

Issue 1395523002: Added parsing of either space or colon for sctp-port. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added requested TODO. Created 5 years, 2 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 | talk/app/webrtc/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 * libjingle 2 * libjingle
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 } 1118 }
1119 return true; 1119 return true;
1120 } 1120 }
1121 1121
1122 bool ParseSctpPort(const std::string& line, 1122 bool ParseSctpPort(const std::string& line,
1123 int* sctp_port, 1123 int* sctp_port,
1124 SdpParseError* error) { 1124 SdpParseError* error) {
1125 // draft-ietf-mmusic-sctp-sdp-07 1125 // draft-ietf-mmusic-sctp-sdp-07
1126 // a=sctp-port 1126 // a=sctp-port
1127 std::vector<std::string> fields; 1127 std::vector<std::string> fields;
1128 rtc::split(line.substr(kLinePrefixLength),
1129 kSdpDelimiterSpace, &fields);
1130 const size_t expected_min_fields = 2; 1128 const size_t expected_min_fields = 2;
1129 rtc::split(line.substr(kLinePrefixLength), kSdpDelimiterColon, &fields);
1130 if (fields.size() < expected_min_fields) {
1131 fields.resize(0);
1132 rtc::split(line.substr(kLinePrefixLength), kSdpDelimiterSpace, &fields);
1133 }
1131 if (fields.size() < expected_min_fields) { 1134 if (fields.size() < expected_min_fields) {
1132 return ParseFailedExpectMinFieldNum(line, expected_min_fields, error); 1135 return ParseFailedExpectMinFieldNum(line, expected_min_fields, error);
1133 } 1136 }
1134 if (!rtc::FromString(fields[1], sctp_port)) { 1137 if (!rtc::FromString(fields[1], sctp_port)) {
1135 return ParseFailed(line, 1138 return ParseFailed(line, "Invalid sctp port value.", error);
1136 "Invalid sctp port value.",
1137 error);
1138 } 1139 }
1139 return true; 1140 return true;
1140 } 1141 }
1141 1142
1142 bool ParseExtmap(const std::string& line, RtpHeaderExtension* extmap, 1143 bool ParseExtmap(const std::string& line, RtpHeaderExtension* extmap,
1143 SdpParseError* error) { 1144 SdpParseError* error) {
1144 // RFC 5285 1145 // RFC 5285
1145 // a=extmap:<value>["/"<direction>] <URI> <extensionattributes> 1146 // a=extmap:<value>["/"<direction>] <URI> <extensionattributes>
1146 std::vector<std::string> fields; 1147 std::vector<std::string> fields;
1147 rtc::split(line.substr(kLinePrefixLength), 1148 rtc::split(line.substr(kLinePrefixLength),
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 if (IsDtlsSctp(media_desc->protocol())) { 1342 if (IsDtlsSctp(media_desc->protocol())) {
1342 BuildSctpContentAttributes(message, sctp_port); 1343 BuildSctpContentAttributes(message, sctp_port);
1343 } else if (IsRtp(media_desc->protocol())) { 1344 } else if (IsRtp(media_desc->protocol())) {
1344 BuildRtpContentAttributes(media_desc, media_type, message); 1345 BuildRtpContentAttributes(media_desc, media_type, message);
1345 } 1346 }
1346 } 1347 }
1347 1348
1348 void BuildSctpContentAttributes(std::string* message, int sctp_port) { 1349 void BuildSctpContentAttributes(std::string* message, int sctp_port) {
1349 // draft-ietf-mmusic-sctp-sdp-04 1350 // draft-ietf-mmusic-sctp-sdp-04
1350 // a=sctpmap:sctpmap-number protocol [streams] 1351 // a=sctpmap:sctpmap-number protocol [streams]
1352 // TODO(lally): switch this over to mmusic-sctp-sdp-12 (or later), with
1353 // 'a=sctp-port:'
1351 std::ostringstream os; 1354 std::ostringstream os;
1352 InitAttrLine(kAttributeSctpmap, &os); 1355 InitAttrLine(kAttributeSctpmap, &os);
1353 os << kSdpDelimiterColon << sctp_port << kSdpDelimiterSpace 1356 os << kSdpDelimiterColon << sctp_port << kSdpDelimiterSpace
1354 << kDefaultSctpmapProtocol << kSdpDelimiterSpace 1357 << kDefaultSctpmapProtocol << kSdpDelimiterSpace
1355 << (cricket::kMaxSctpSid + 1); 1358 << (cricket::kMaxSctpSid + 1);
1356 AddLine(os.str(), message); 1359 AddLine(os.str(), message);
1357 } 1360 }
1358 1361
1359 void BuildRtpContentAttributes( 1362 void BuildRtpContentAttributes(
1360 const MediaContentDescription* media_desc, 1363 const MediaContentDescription* media_desc,
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( 3071 UpdateCodec<AudioContentDescription, cricket::AudioCodec>(
3069 media_desc, payload_type, feedback_param); 3072 media_desc, payload_type, feedback_param);
3070 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { 3073 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
3071 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( 3074 UpdateCodec<VideoContentDescription, cricket::VideoCodec>(
3072 media_desc, payload_type, feedback_param); 3075 media_desc, payload_type, feedback_param);
3073 } 3076 }
3074 return true; 3077 return true;
3075 } 3078 }
3076 3079
3077 } // namespace webrtc 3080 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/webrtcsdp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698