Chromium Code Reviews| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 static const char kLineTypeTimeZone = 'z'; | 101 static const char kLineTypeTimeZone = 'z'; |
| 102 static const char kLineTypeEncryptionKey = 'k'; | 102 static const char kLineTypeEncryptionKey = 'k'; |
| 103 static const char kLineTypeMedia = 'm'; | 103 static const char kLineTypeMedia = 'm'; |
| 104 static const char kLineTypeConnection = 'c'; | 104 static const char kLineTypeConnection = 'c'; |
| 105 static const char kLineTypeAttributes = 'a'; | 105 static const char kLineTypeAttributes = 'a'; |
| 106 | 106 |
| 107 // Attributes | 107 // Attributes |
| 108 static const char kAttributeGroup[] = "group"; | 108 static const char kAttributeGroup[] = "group"; |
| 109 static const char kAttributeMid[] = "mid"; | 109 static const char kAttributeMid[] = "mid"; |
| 110 static const char kAttributeMsid[] = "msid"; | 110 static const char kAttributeMsid[] = "msid"; |
| 111 static const char kAttributeBundleOnly[] = "bundle-only"; | |
| 111 static const char kAttributeRtcpMux[] = "rtcp-mux"; | 112 static const char kAttributeRtcpMux[] = "rtcp-mux"; |
| 112 static const char kAttributeRtcpReducedSize[] = "rtcp-rsize"; | 113 static const char kAttributeRtcpReducedSize[] = "rtcp-rsize"; |
| 113 static const char kAttributeSsrc[] = "ssrc"; | 114 static const char kAttributeSsrc[] = "ssrc"; |
| 114 static const char kSsrcAttributeCname[] = "cname"; | 115 static const char kSsrcAttributeCname[] = "cname"; |
| 115 static const char kAttributeExtmap[] = "extmap"; | 116 static const char kAttributeExtmap[] = "extmap"; |
| 116 // draft-alvestrand-mmusic-msid-01 | 117 // draft-alvestrand-mmusic-msid-01 |
| 117 // a=msid-semantic: WMS | 118 // a=msid-semantic: WMS |
| 118 static const char kAttributeMsidSemantics[] = "msid-semantic"; | 119 static const char kAttributeMsidSemantics[] = "msid-semantic"; |
| 119 static const char kMediaStreamSemantic[] = "WMS"; | 120 static const char kMediaStreamSemantic[] = "WMS"; |
| 120 static const char kSsrcAttributeMsid[] = "msid"; | 121 static const char kSsrcAttributeMsid[] = "msid"; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 size_t* pos, cricket::SessionDescription* desc, | 269 size_t* pos, cricket::SessionDescription* desc, |
| 269 std::vector<JsepIceCandidate*>* candidates, | 270 std::vector<JsepIceCandidate*>* candidates, |
| 270 SdpParseError* error); | 271 SdpParseError* error); |
| 271 static bool ParseContent(const std::string& message, | 272 static bool ParseContent(const std::string& message, |
| 272 const MediaType media_type, | 273 const MediaType media_type, |
| 273 int mline_index, | 274 int mline_index, |
| 274 const std::string& protocol, | 275 const std::string& protocol, |
| 275 const std::vector<int>& payload_types, | 276 const std::vector<int>& payload_types, |
| 276 size_t* pos, | 277 size_t* pos, |
| 277 std::string* content_name, | 278 std::string* content_name, |
| 279 bool* bundle_only, | |
| 278 MediaContentDescription* media_desc, | 280 MediaContentDescription* media_desc, |
| 279 TransportDescription* transport, | 281 TransportDescription* transport, |
| 280 std::vector<JsepIceCandidate*>* candidates, | 282 std::vector<JsepIceCandidate*>* candidates, |
| 281 SdpParseError* error); | 283 SdpParseError* error); |
|
pthatcher1
2016/12/12 23:38:29
This could really use one out parameter that is a
Taylor Brandstetter
2016/12/13 02:13:59
Agreed, I don't know why we can't just use a Conte
| |
| 282 static bool ParseSsrcAttribute(const std::string& line, | 284 static bool ParseSsrcAttribute(const std::string& line, |
| 283 SsrcInfoVec* ssrc_infos, | 285 SsrcInfoVec* ssrc_infos, |
| 284 SdpParseError* error); | 286 SdpParseError* error); |
| 285 static bool ParseSsrcGroupAttribute(const std::string& line, | 287 static bool ParseSsrcGroupAttribute(const std::string& line, |
| 286 SsrcGroupVec* ssrc_groups, | 288 SsrcGroupVec* ssrc_groups, |
| 287 SdpParseError* error); | 289 SdpParseError* error); |
| 288 static bool ParseCryptoAttribute(const std::string& line, | 290 static bool ParseCryptoAttribute(const std::string& line, |
| 289 MediaContentDescription* media_desc, | 291 MediaContentDescription* media_desc, |
| 290 SdpParseError* error); | 292 SdpParseError* error); |
| 291 static bool ParseRtpmapAttribute(const std::string& line, | 293 static bool ParseRtpmapAttribute(const std::string& line, |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1275 fmt.append(rtc::ToString<int>(it->id)); | 1277 fmt.append(rtc::ToString<int>(it->id)); |
| 1276 } | 1278 } |
| 1277 } | 1279 } |
| 1278 } | 1280 } |
| 1279 // The fmt must never be empty. If no codecs are found, set the fmt attribute | 1281 // The fmt must never be empty. If no codecs are found, set the fmt attribute |
| 1280 // to 0. | 1282 // to 0. |
| 1281 if (fmt.empty()) { | 1283 if (fmt.empty()) { |
| 1282 fmt = " 0"; | 1284 fmt = " 0"; |
| 1283 } | 1285 } |
| 1284 | 1286 |
| 1285 // The port number in the m line will be updated later when associate with | 1287 // The port number in the m line will be updated later when associated with |
| 1286 // the candidates. | 1288 // the candidates. |
| 1289 // | |
| 1290 // A port value of 0 indicates that the m= section is rejected. | |
| 1287 // RFC 3264 | 1291 // RFC 3264 |
| 1288 // To reject an offered stream, the port number in the corresponding stream in | 1292 // To reject an offered stream, the port number in the corresponding stream in |
| 1289 // the answer MUST be set to zero. | 1293 // the answer MUST be set to zero. |
| 1290 const std::string& port = content_info->rejected ? | 1294 // |
| 1291 kMediaPortRejected : kDummyPort; | 1295 // However, the BUNDLE draft adds a new meaning to port zero, when used along |
| 1296 // with a=bundle-only. | |
| 1297 const std::string& port = | |
| 1298 (content_info->rejected || content_info->bundle_only) ? kMediaPortRejected | |
| 1299 : kDummyPort; | |
| 1292 | 1300 |
| 1293 rtc::SSLFingerprint* fp = (transport_info) ? | 1301 rtc::SSLFingerprint* fp = (transport_info) ? |
| 1294 transport_info->description.identity_fingerprint.get() : NULL; | 1302 transport_info->description.identity_fingerprint.get() : NULL; |
| 1295 | 1303 |
| 1296 // Add the m and c lines. | 1304 // Add the m and c lines. |
| 1297 InitLine(kLineTypeMedia, type, &os); | 1305 InitLine(kLineTypeMedia, type, &os); |
| 1298 os << " " << port << " " << media_desc->protocol() << fmt; | 1306 os << " " << port << " " << media_desc->protocol() << fmt; |
| 1299 std::string mline = os.str(); | 1307 std::string mline = os.str(); |
| 1300 UpdateMediaDefaultDestination(candidates, mline, message); | 1308 UpdateMediaDefaultDestination(candidates, mline, message); |
| 1301 | 1309 |
| 1302 // RFC 4566 | 1310 // RFC 4566 |
| 1303 // b=AS:<bandwidth> | 1311 // b=AS:<bandwidth> |
| 1304 if (media_desc->bandwidth() >= 1000) { | 1312 if (media_desc->bandwidth() >= 1000) { |
| 1305 InitLine(kLineTypeSessionBandwidth, kApplicationSpecificMaximum, &os); | 1313 InitLine(kLineTypeSessionBandwidth, kApplicationSpecificMaximum, &os); |
| 1306 os << kSdpDelimiterColon << (media_desc->bandwidth() / 1000); | 1314 os << kSdpDelimiterColon << (media_desc->bandwidth() / 1000); |
| 1307 AddLine(os.str(), message); | 1315 AddLine(os.str(), message); |
| 1308 } | 1316 } |
| 1309 | 1317 |
| 1318 // Add the a=bundle-only line. | |
| 1319 if (content_info->bundle_only) { | |
| 1320 InitAttrLine(kAttributeBundleOnly, &os); | |
| 1321 AddLine(os.str(), message); | |
| 1322 } | |
| 1323 | |
| 1310 // Add the a=rtcp line. | 1324 // Add the a=rtcp line. |
| 1311 if (IsRtp(media_desc->protocol())) { | 1325 if (IsRtp(media_desc->protocol())) { |
| 1312 std::string rtcp_line = GetRtcpLine(candidates); | 1326 std::string rtcp_line = GetRtcpLine(candidates); |
| 1313 if (!rtcp_line.empty()) { | 1327 if (!rtcp_line.empty()) { |
| 1314 AddLine(rtcp_line, message); | 1328 AddLine(rtcp_line, message); |
| 1315 } | 1329 } |
| 1316 } | 1330 } |
| 1317 | 1331 |
| 1318 // Build the a=candidate lines. We don't include ufrag and pwd in the | 1332 // Build the a=candidate lines. We don't include ufrag and pwd in the |
| 1319 // candidates in the SDP to avoid redundancy. | 1333 // candidates in the SDP to avoid redundancy. |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2203 } | 2217 } |
| 2204 | 2218 |
| 2205 template <class C> | 2219 template <class C> |
| 2206 static C* ParseContentDescription(const std::string& message, | 2220 static C* ParseContentDescription(const std::string& message, |
| 2207 const MediaType media_type, | 2221 const MediaType media_type, |
| 2208 int mline_index, | 2222 int mline_index, |
| 2209 const std::string& protocol, | 2223 const std::string& protocol, |
| 2210 const std::vector<int>& payload_types, | 2224 const std::vector<int>& payload_types, |
| 2211 size_t* pos, | 2225 size_t* pos, |
| 2212 std::string* content_name, | 2226 std::string* content_name, |
| 2227 bool* bundle_only, | |
| 2213 TransportDescription* transport, | 2228 TransportDescription* transport, |
| 2214 std::vector<JsepIceCandidate*>* candidates, | 2229 std::vector<JsepIceCandidate*>* candidates, |
| 2215 webrtc::SdpParseError* error) { | 2230 webrtc::SdpParseError* error) { |
| 2216 C* media_desc = new C(); | 2231 C* media_desc = new C(); |
| 2217 switch (media_type) { | 2232 switch (media_type) { |
| 2218 case cricket::MEDIA_TYPE_AUDIO: | 2233 case cricket::MEDIA_TYPE_AUDIO: |
| 2219 *content_name = cricket::CN_AUDIO; | 2234 *content_name = cricket::CN_AUDIO; |
| 2220 break; | 2235 break; |
| 2221 case cricket::MEDIA_TYPE_VIDEO: | 2236 case cricket::MEDIA_TYPE_VIDEO: |
| 2222 *content_name = cricket::CN_VIDEO; | 2237 *content_name = cricket::CN_VIDEO; |
| 2223 break; | 2238 break; |
| 2224 case cricket::MEDIA_TYPE_DATA: | 2239 case cricket::MEDIA_TYPE_DATA: |
| 2225 *content_name = cricket::CN_DATA; | 2240 *content_name = cricket::CN_DATA; |
| 2226 break; | 2241 break; |
| 2227 default: | 2242 default: |
| 2228 ASSERT(false); | 2243 ASSERT(false); |
| 2229 break; | 2244 break; |
| 2230 } | 2245 } |
| 2231 if (!ParseContent(message, media_type, mline_index, protocol, payload_types, | 2246 if (!ParseContent(message, media_type, mline_index, protocol, payload_types, |
| 2232 pos, content_name, media_desc, transport, candidates, | 2247 pos, content_name, bundle_only, media_desc, transport, |
| 2233 error)) { | 2248 candidates, error)) { |
| 2234 delete media_desc; | 2249 delete media_desc; |
| 2235 return NULL; | 2250 return NULL; |
| 2236 } | 2251 } |
| 2237 // Sort the codecs according to the m-line fmt list. | 2252 // Sort the codecs according to the m-line fmt list. |
| 2238 std::unordered_map<int, int> payload_type_preferences; | 2253 std::unordered_map<int, int> payload_type_preferences; |
| 2239 // "size + 1" so that the lowest preference payload type has a preference of | 2254 // "size + 1" so that the lowest preference payload type has a preference of |
| 2240 // 1, which is greater than the default (0) for payload types not in the fmt | 2255 // 1, which is greater than the default (0) for payload types not in the fmt |
| 2241 // list. | 2256 // list. |
| 2242 int preference = static_cast<int>(payload_types.size() + 1); | 2257 int preference = static_cast<int>(payload_types.size() + 1); |
| 2243 for (int pt : payload_types) { | 2258 for (int pt : payload_types) { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 2270 while (GetLineWithType(message, pos, &line, kLineTypeMedia)) { | 2285 while (GetLineWithType(message, pos, &line, kLineTypeMedia)) { |
| 2271 ++mline_index; | 2286 ++mline_index; |
| 2272 | 2287 |
| 2273 std::vector<std::string> fields; | 2288 std::vector<std::string> fields; |
| 2274 rtc::split(line.substr(kLinePrefixLength), | 2289 rtc::split(line.substr(kLinePrefixLength), |
| 2275 kSdpDelimiterSpace, &fields); | 2290 kSdpDelimiterSpace, &fields); |
| 2276 const size_t expected_min_fields = 4; | 2291 const size_t expected_min_fields = 4; |
| 2277 if (fields.size() < expected_min_fields) { | 2292 if (fields.size() < expected_min_fields) { |
| 2278 return ParseFailedExpectMinFieldNum(line, expected_min_fields, error); | 2293 return ParseFailedExpectMinFieldNum(line, expected_min_fields, error); |
| 2279 } | 2294 } |
| 2280 bool rejected = false; | 2295 bool port_rejected = false; |
| 2281 // RFC 3264 | 2296 // RFC 3264 |
| 2282 // To reject an offered stream, the port number in the corresponding stream | 2297 // To reject an offered stream, the port number in the corresponding stream |
| 2283 // in the answer MUST be set to zero. | 2298 // in the answer MUST be set to zero. |
| 2284 if (fields[1] == kMediaPortRejected) { | 2299 if (fields[1] == kMediaPortRejected) { |
| 2285 rejected = true; | 2300 port_rejected = true; |
| 2286 } | 2301 } |
| 2287 | 2302 |
| 2288 std::string protocol = fields[2]; | 2303 std::string protocol = fields[2]; |
| 2289 | 2304 |
| 2290 // <fmt> | 2305 // <fmt> |
| 2291 std::vector<int> payload_types; | 2306 std::vector<int> payload_types; |
| 2292 if (IsRtp(protocol)) { | 2307 if (IsRtp(protocol)) { |
| 2293 for (size_t j = 3 ; j < fields.size(); ++j) { | 2308 for (size_t j = 3 ; j < fields.size(); ++j) { |
| 2294 // TODO(wu): Remove when below bug is fixed. | 2309 // TODO(wu): Remove when below bug is fixed. |
| 2295 // https://bugzilla.mozilla.org/show_bug.cgi?id=996329 | 2310 // https://bugzilla.mozilla.org/show_bug.cgi?id=996329 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 2307 | 2322 |
| 2308 // Make a temporary TransportDescription based on |session_td|. | 2323 // Make a temporary TransportDescription based on |session_td|. |
| 2309 // Some of this gets overwritten by ParseContent. | 2324 // Some of this gets overwritten by ParseContent. |
| 2310 TransportDescription transport( | 2325 TransportDescription transport( |
| 2311 session_td.transport_options, session_td.ice_ufrag, session_td.ice_pwd, | 2326 session_td.transport_options, session_td.ice_ufrag, session_td.ice_pwd, |
| 2312 session_td.ice_mode, session_td.connection_role, | 2327 session_td.ice_mode, session_td.connection_role, |
| 2313 session_td.identity_fingerprint.get()); | 2328 session_td.identity_fingerprint.get()); |
| 2314 | 2329 |
| 2315 std::unique_ptr<MediaContentDescription> content; | 2330 std::unique_ptr<MediaContentDescription> content; |
| 2316 std::string content_name; | 2331 std::string content_name; |
| 2332 bool bundle_only = false; | |
| 2317 if (HasAttribute(line, kMediaTypeVideo)) { | 2333 if (HasAttribute(line, kMediaTypeVideo)) { |
| 2318 content.reset(ParseContentDescription<VideoContentDescription>( | 2334 content.reset(ParseContentDescription<VideoContentDescription>( |
| 2319 message, cricket::MEDIA_TYPE_VIDEO, mline_index, protocol, | 2335 message, cricket::MEDIA_TYPE_VIDEO, mline_index, protocol, |
| 2320 payload_types, pos, &content_name, &transport, candidates, error)); | 2336 payload_types, pos, &content_name, &bundle_only, &transport, |
| 2337 candidates, error)); | |
| 2321 } else if (HasAttribute(line, kMediaTypeAudio)) { | 2338 } else if (HasAttribute(line, kMediaTypeAudio)) { |
| 2322 content.reset(ParseContentDescription<AudioContentDescription>( | 2339 content.reset(ParseContentDescription<AudioContentDescription>( |
| 2323 message, cricket::MEDIA_TYPE_AUDIO, mline_index, protocol, | 2340 message, cricket::MEDIA_TYPE_AUDIO, mline_index, protocol, |
| 2324 payload_types, pos, &content_name, &transport, candidates, error)); | 2341 payload_types, pos, &content_name, &bundle_only, &transport, |
| 2342 candidates, error)); | |
| 2325 } else if (HasAttribute(line, kMediaTypeData)) { | 2343 } else if (HasAttribute(line, kMediaTypeData)) { |
| 2326 DataContentDescription* data_desc = | 2344 DataContentDescription* data_desc = |
| 2327 ParseContentDescription<DataContentDescription>( | 2345 ParseContentDescription<DataContentDescription>( |
| 2328 message, cricket::MEDIA_TYPE_DATA, mline_index, protocol, | 2346 message, cricket::MEDIA_TYPE_DATA, mline_index, protocol, |
| 2329 payload_types, pos, &content_name, &transport, candidates, error); | 2347 payload_types, pos, &content_name, &bundle_only, &transport, |
| 2348 candidates, error); | |
| 2330 content.reset(data_desc); | 2349 content.reset(data_desc); |
| 2331 | 2350 |
| 2332 int p; | 2351 int p; |
| 2333 if (data_desc && IsDtlsSctp(protocol) && rtc::FromString(fields[3], &p)) { | 2352 if (data_desc && IsDtlsSctp(protocol) && rtc::FromString(fields[3], &p)) { |
| 2334 if (!AddSctpDataCodec(data_desc, p)) | 2353 if (!AddSctpDataCodec(data_desc, p)) |
| 2335 return false; | 2354 return false; |
| 2336 } | 2355 } |
| 2337 } else { | 2356 } else { |
| 2338 LOG(LS_WARNING) << "Unsupported media type: " << line; | 2357 LOG(LS_WARNING) << "Unsupported media type: " << line; |
| 2339 continue; | 2358 continue; |
| 2340 } | 2359 } |
| 2341 if (!content.get()) { | 2360 if (!content.get()) { |
| 2342 // ParseContentDescription returns NULL if failed. | 2361 // ParseContentDescription returns NULL if failed. |
| 2343 return false; | 2362 return false; |
| 2344 } | 2363 } |
| 2345 | 2364 |
| 2365 bool content_rejected = false; | |
| 2366 if (bundle_only) { | |
| 2367 // A port of 0 is not interpreted as a rejected m= section when it's | |
| 2368 // used along with a=bundle-only. | |
| 2369 if (!port_rejected) { | |
| 2370 return ParseFailed( | |
| 2371 "a=bundle-only", | |
| 2372 "a=bundle-only MUST only be used in combination with a 0 port.", | |
| 2373 error); | |
| 2374 } | |
|
pthatcher1
2017/01/03 17:31:01
It looks like we need to remove this block (or com
| |
| 2375 } else { | |
| 2376 // If not using bundle-only, interpret port 0 in the normal way; the m= | |
| 2377 // section is being rejected. | |
| 2378 content_rejected = port_rejected; | |
| 2379 } | |
| 2380 | |
| 2346 if (IsRtp(protocol)) { | 2381 if (IsRtp(protocol)) { |
| 2347 // Set the extmap. | 2382 // Set the extmap. |
| 2348 if (!session_extmaps.empty() && | 2383 if (!session_extmaps.empty() && |
| 2349 !content->rtp_header_extensions().empty()) { | 2384 !content->rtp_header_extensions().empty()) { |
| 2350 return ParseFailed("", | 2385 return ParseFailed("", |
| 2351 "The a=extmap MUST be either all session level or " | 2386 "The a=extmap MUST be either all session level or " |
| 2352 "all media level.", | 2387 "all media level.", |
| 2353 error); | 2388 error); |
| 2354 } | 2389 } |
| 2355 for (size_t i = 0; i < session_extmaps.size(); ++i) { | 2390 for (size_t i = 0; i < session_extmaps.size(); ++i) { |
| 2356 content->AddRtpHeaderExtension(session_extmaps[i]); | 2391 content->AddRtpHeaderExtension(session_extmaps[i]); |
| 2357 } | 2392 } |
| 2358 } | 2393 } |
| 2359 content->set_protocol(protocol); | 2394 content->set_protocol(protocol); |
| 2360 desc->AddContent(content_name, | 2395 desc->AddContent(content_name, |
| 2361 IsDtlsSctp(protocol) ? cricket::NS_JINGLE_DRAFT_SCTP : | 2396 IsDtlsSctp(protocol) ? cricket::NS_JINGLE_DRAFT_SCTP |
| 2362 cricket::NS_JINGLE_RTP, | 2397 : cricket::NS_JINGLE_RTP, |
| 2363 rejected, | 2398 content_rejected, bundle_only, content.release()); |
| 2364 content.release()); | |
| 2365 // Create TransportInfo with the media level "ice-pwd" and "ice-ufrag". | 2399 // Create TransportInfo with the media level "ice-pwd" and "ice-ufrag". |
| 2366 TransportInfo transport_info(content_name, transport); | 2400 TransportInfo transport_info(content_name, transport); |
| 2367 | 2401 |
| 2368 if (!desc->AddTransportInfo(transport_info)) { | 2402 if (!desc->AddTransportInfo(transport_info)) { |
| 2369 std::ostringstream description; | 2403 std::ostringstream description; |
| 2370 description << "Failed to AddTransportInfo with content name: " | 2404 description << "Failed to AddTransportInfo with content name: " |
| 2371 << content_name; | 2405 << content_name; |
| 2372 return ParseFailed("", description.str(), error); | 2406 return ParseFailed("", description.str(), error); |
| 2373 } | 2407 } |
| 2374 } | 2408 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2530 audio_desc->set_codecs(codecs); | 2564 audio_desc->set_codecs(codecs); |
| 2531 } | 2565 } |
| 2532 | 2566 |
| 2533 bool ParseContent(const std::string& message, | 2567 bool ParseContent(const std::string& message, |
| 2534 const MediaType media_type, | 2568 const MediaType media_type, |
| 2535 int mline_index, | 2569 int mline_index, |
| 2536 const std::string& protocol, | 2570 const std::string& protocol, |
| 2537 const std::vector<int>& payload_types, | 2571 const std::vector<int>& payload_types, |
| 2538 size_t* pos, | 2572 size_t* pos, |
| 2539 std::string* content_name, | 2573 std::string* content_name, |
| 2574 bool* bundle_only, | |
| 2540 MediaContentDescription* media_desc, | 2575 MediaContentDescription* media_desc, |
| 2541 TransportDescription* transport, | 2576 TransportDescription* transport, |
| 2542 std::vector<JsepIceCandidate*>* candidates, | 2577 std::vector<JsepIceCandidate*>* candidates, |
| 2543 SdpParseError* error) { | 2578 SdpParseError* error) { |
| 2544 ASSERT(media_desc != NULL); | 2579 ASSERT(media_desc != NULL); |
| 2545 ASSERT(content_name != NULL); | 2580 ASSERT(content_name != NULL); |
| 2546 ASSERT(transport != NULL); | 2581 ASSERT(transport != NULL); |
| 2547 | 2582 |
| 2548 if (media_type == cricket::MEDIA_TYPE_AUDIO) { | 2583 if (media_type == cricket::MEDIA_TYPE_AUDIO) { |
| 2549 MaybeCreateStaticPayloadAudioCodecs( | 2584 MaybeCreateStaticPayloadAudioCodecs( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2612 // Handle attributes common to SCTP and RTP. | 2647 // Handle attributes common to SCTP and RTP. |
| 2613 if (HasAttribute(line, kAttributeMid)) { | 2648 if (HasAttribute(line, kAttributeMid)) { |
| 2614 // RFC 3388 | 2649 // RFC 3388 |
| 2615 // mid-attribute = "a=mid:" identification-tag | 2650 // mid-attribute = "a=mid:" identification-tag |
| 2616 // identification-tag = token | 2651 // identification-tag = token |
| 2617 // Use the mid identification-tag as the content name. | 2652 // Use the mid identification-tag as the content name. |
| 2618 if (!GetValue(line, kAttributeMid, &mline_id, error)) { | 2653 if (!GetValue(line, kAttributeMid, &mline_id, error)) { |
| 2619 return false; | 2654 return false; |
| 2620 } | 2655 } |
| 2621 *content_name = mline_id; | 2656 *content_name = mline_id; |
| 2657 } else if (HasAttribute(line, kAttributeBundleOnly)) { | |
| 2658 *bundle_only = true; | |
| 2622 } else if (HasAttribute(line, kAttributeCandidate)) { | 2659 } else if (HasAttribute(line, kAttributeCandidate)) { |
| 2623 Candidate candidate; | 2660 Candidate candidate; |
| 2624 if (!ParseCandidate(line, &candidate, error, false)) { | 2661 if (!ParseCandidate(line, &candidate, error, false)) { |
| 2625 return false; | 2662 return false; |
| 2626 } | 2663 } |
| 2627 candidates_orig.push_back(candidate); | 2664 candidates_orig.push_back(candidate); |
| 2628 } else if (HasAttribute(line, kAttributeIceUfrag)) { | 2665 } else if (HasAttribute(line, kAttributeIceUfrag)) { |
| 2629 if (!GetValue(line, kAttributeIceUfrag, &transport->ice_ufrag, error)) { | 2666 if (!GetValue(line, kAttributeIceUfrag, &transport->ice_ufrag, error)) { |
| 2630 return false; | 2667 return false; |
| 2631 } | 2668 } |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3173 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3210 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
| 3174 media_desc, payload_type, feedback_param); | 3211 media_desc, payload_type, feedback_param); |
| 3175 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3212 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
| 3176 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3213 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
| 3177 media_desc, payload_type, feedback_param); | 3214 media_desc, payload_type, feedback_param); |
| 3178 } | 3215 } |
| 3179 return true; | 3216 return true; |
| 3180 } | 3217 } |
| 3181 | 3218 |
| 3182 } // namespace webrtc | 3219 } // namespace webrtc |
| OLD | NEW |