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 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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. | |
2727 if (b == -1) { | |
2728 LOG(LS_WARNING) << "Ignoring \"b=AS:-1\"; will be treated as \"no " | |
2729 "bandwidth limit\"."; | |
2730 continue; | |
2731 } | |
2722 if (b < 0) { | 2732 if (b < 0) { |
2723 return ParseFailed(line, "b=AS value can't be negative.", error); | 2733 return ParseFailed(line, "b=AS value can't be negative.", error); |
Zhi Huang
2017/08/03 23:37:40
"b=AS value can't be negative other than -1"?
Taylor Brandstetter
2017/08/04 00:10:20
Technically, but I don't want to encourage people
| |
2724 } | 2734 } |
2725 // We should never use more than the default bandwidth for RTP-based | 2735 // We should never use more than the default bandwidth for RTP-based |
2726 // data channels. Don't allow SDP to set the bandwidth, because | 2736 // data channels. Don't allow SDP to set the bandwidth, because |
2727 // that would give JS the opportunity to "break the Internet". | 2737 // that would give JS the opportunity to "break the Internet". |
2728 // See: https://code.google.com/p/chromium/issues/detail?id=280726 | 2738 // See: https://code.google.com/p/chromium/issues/detail?id=280726 |
2729 if (media_type == cricket::MEDIA_TYPE_DATA && IsRtp(protocol) && | 2739 if (media_type == cricket::MEDIA_TYPE_DATA && IsRtp(protocol) && |
2730 b > cricket::kDataMaxBandwidth / 1000) { | 2740 b > cricket::kDataMaxBandwidth / 1000) { |
2731 std::ostringstream description; | 2741 std::ostringstream description; |
2732 description << "RTP-based data channels may not send more than " | 2742 description << "RTP-based data channels may not send more than " |
2733 << cricket::kDataMaxBandwidth / 1000 << "kbps."; | 2743 << cricket::kDataMaxBandwidth / 1000 << "kbps."; |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3317 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3327 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3318 media_desc, payload_type, feedback_param); | 3328 media_desc, payload_type, feedback_param); |
3319 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3329 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3320 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3330 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3321 media_desc, payload_type, feedback_param); | 3331 media_desc, payload_type, feedback_param); |
3322 } | 3332 } |
3323 return true; | 3333 return true; |
3324 } | 3334 } |
3325 | 3335 |
3326 } // namespace webrtc | 3336 } // namespace webrtc |
OLD | NEW |