| 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 if (b < 0) { |
| 2723 return ParseFailed(line, "b=AS value can't be negative.", error); |
| 2724 } |
| 2722 // We should never use more than the default bandwidth for RTP-based | 2725 // We should never use more than the default bandwidth for RTP-based |
| 2723 // data channels. Don't allow SDP to set the bandwidth, because | 2726 // data channels. Don't allow SDP to set the bandwidth, because |
| 2724 // that would give JS the opportunity to "break the Internet". | 2727 // that would give JS the opportunity to "break the Internet". |
| 2725 // See: https://code.google.com/p/chromium/issues/detail?id=280726 | 2728 // See: https://code.google.com/p/chromium/issues/detail?id=280726 |
| 2726 if (media_type == cricket::MEDIA_TYPE_DATA && IsRtp(protocol) && | 2729 if (media_type == cricket::MEDIA_TYPE_DATA && IsRtp(protocol) && |
| 2727 b > cricket::kDataMaxBandwidth / 1000) { | 2730 b > cricket::kDataMaxBandwidth / 1000) { |
| 2728 std::ostringstream description; | 2731 std::ostringstream description; |
| 2729 description << "RTP-based data channels may not send more than " | 2732 description << "RTP-based data channels may not send more than " |
| 2730 << cricket::kDataMaxBandwidth / 1000 << "kbps."; | 2733 << cricket::kDataMaxBandwidth / 1000 << "kbps."; |
| 2731 return ParseFailed(line, description.str(), error); | 2734 return ParseFailed(line, description.str(), error); |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3314 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3317 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
| 3315 media_desc, payload_type, feedback_param); | 3318 media_desc, payload_type, feedback_param); |
| 3316 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3319 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
| 3317 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3320 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
| 3318 media_desc, payload_type, feedback_param); | 3321 media_desc, payload_type, feedback_param); |
| 3319 } | 3322 } |
| 3320 return true; | 3323 return true; |
| 3321 } | 3324 } |
| 3322 | 3325 |
| 3323 } // namespace webrtc | 3326 } // namespace webrtc |
| OLD | NEW |