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 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2590 // data channels. Don't allow SDP to set the bandwidth, because | 2590 // data channels. Don't allow SDP to set the bandwidth, because |
2591 // that would give JS the opportunity to "break the Internet". | 2591 // that would give JS the opportunity to "break the Internet". |
2592 // See: https://code.google.com/p/chromium/issues/detail?id=280726 | 2592 // See: https://code.google.com/p/chromium/issues/detail?id=280726 |
2593 if (media_type == cricket::MEDIA_TYPE_DATA && IsRtp(protocol) && | 2593 if (media_type == cricket::MEDIA_TYPE_DATA && IsRtp(protocol) && |
2594 b > cricket::kDataMaxBandwidth / 1000) { | 2594 b > cricket::kDataMaxBandwidth / 1000) { |
2595 std::ostringstream description; | 2595 std::ostringstream description; |
2596 description << "RTP-based data channels may not send more than " | 2596 description << "RTP-based data channels may not send more than " |
2597 << cricket::kDataMaxBandwidth / 1000 << "kbps."; | 2597 << cricket::kDataMaxBandwidth / 1000 << "kbps."; |
2598 return ParseFailed(line, description.str(), error); | 2598 return ParseFailed(line, description.str(), error); |
2599 } | 2599 } |
| 2600 // Prevent integer overflow. |
| 2601 b = std::min(b, INT_MAX / 1000); |
2600 media_desc->set_bandwidth(b * 1000); | 2602 media_desc->set_bandwidth(b * 1000); |
2601 } | 2603 } |
2602 } | 2604 } |
2603 continue; | 2605 continue; |
2604 } | 2606 } |
2605 | 2607 |
2606 if (!IsLineType(line, kLineTypeAttributes)) { | 2608 if (!IsLineType(line, kLineTypeAttributes)) { |
2607 // TODO: Handle other lines if needed. | 2609 // TODO: Handle other lines if needed. |
2608 LOG(LS_INFO) << "Ignored line: " << line; | 2610 LOG(LS_INFO) << "Ignored line: " << line; |
2609 continue; | 2611 continue; |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3173 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3175 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3174 media_desc, payload_type, feedback_param); | 3176 media_desc, payload_type, feedback_param); |
3175 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3177 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3176 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3178 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3177 media_desc, payload_type, feedback_param); | 3179 media_desc, payload_type, feedback_param); |
3178 } | 3180 } |
3179 return true; | 3181 return true; |
3180 } | 3182 } |
3181 | 3183 |
3182 } // namespace webrtc | 3184 } // namespace webrtc |
OLD | NEW |