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

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

Issue 2995463002: Ignore "b=AS:-1" instead of treating as a hard error. (Closed)
Patch Set: Created 3 years, 4 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/pc/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 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 if (IsLineType(line, kLineTypeSessionBandwidth)) { 2712 if (IsLineType(line, kLineTypeSessionBandwidth)) {
2713 std::string bandwidth; 2713 std::string bandwidth;
2714 if (HasAttribute(line, kApplicationSpecificMaximum)) { 2714 if (HasAttribute(line, kApplicationSpecificMaximum)) {
2715 if (!GetValue(line, kApplicationSpecificMaximum, &bandwidth, error)) { 2715 if (!GetValue(line, kApplicationSpecificMaximum, &bandwidth, error)) {
2716 return false; 2716 return false;
2717 } else { 2717 } else {
2718 int b = 0; 2718 int b = 0;
2719 if (!GetValueFromString(line, bandwidth, &b, error)) { 2719 if (!GetValueFromString(line, bandwidth, &b, error)) {
2720 return false; 2720 return false;
2721 } 2721 }
2722 // TODO(deadbeef): Historically, applications may be setting a value
2723 // of -1 to mean "unset any previously set bandwidth limit", even
2724 // though ommitting the "b=AS" entirely will do just that. Once we've
2725 // transitioned applications to doing the right thing, it would be
2726 // better to treat this as a hard error instead of just ignoring it.
Zhi Huang 2017/08/03 18:12:47 Is -1 the only valid negative value? If so, should
Taylor Brandstetter 2017/08/03 21:44:33 I guess so. I'll add back the "ParseFailed" here a
2722 if (b < 0) { 2727 if (b < 0) {
2723 return ParseFailed(line, "b=AS value can't be negative.", error); 2728 LOG(LS_WARNING)
2729 << "SDP contains negative value for b=AS; ignoring.";
2730 continue;
2724 } 2731 }
2725 // We should never use more than the default bandwidth for RTP-based 2732 // We should never use more than the default bandwidth for RTP-based
2726 // data channels. Don't allow SDP to set the bandwidth, because 2733 // data channels. Don't allow SDP to set the bandwidth, because
2727 // that would give JS the opportunity to "break the Internet". 2734 // that would give JS the opportunity to "break the Internet".
2728 // See: https://code.google.com/p/chromium/issues/detail?id=280726 2735 // See: https://code.google.com/p/chromium/issues/detail?id=280726
2729 if (media_type == cricket::MEDIA_TYPE_DATA && IsRtp(protocol) && 2736 if (media_type == cricket::MEDIA_TYPE_DATA && IsRtp(protocol) &&
2730 b > cricket::kDataMaxBandwidth / 1000) { 2737 b > cricket::kDataMaxBandwidth / 1000) {
2731 std::ostringstream description; 2738 std::ostringstream description;
2732 description << "RTP-based data channels may not send more than " 2739 description << "RTP-based data channels may not send more than "
2733 << cricket::kDataMaxBandwidth / 1000 << "kbps."; 2740 << cricket::kDataMaxBandwidth / 1000 << "kbps.";
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3317 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( 3324 UpdateCodec<AudioContentDescription, cricket::AudioCodec>(
3318 media_desc, payload_type, feedback_param); 3325 media_desc, payload_type, feedback_param);
3319 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { 3326 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
3320 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( 3327 UpdateCodec<VideoContentDescription, cricket::VideoCodec>(
3321 media_desc, payload_type, feedback_param); 3328 media_desc, payload_type, feedback_param);
3322 } 3329 }
3323 return true; 3330 return true;
3324 } 3331 }
3325 3332
3326 } // namespace webrtc 3333 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/pc/webrtcsdp_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698