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 media_desc->set_bandwidth(b * 1000); | 2600 // Prevent integer overflow. |
2601 media_desc->set_bandwidth(b < INT_MAX / 1000 ? b * 1000 : INT_MAX); | |
pthatcher1
2016/12/13 23:58:05
Can you put a paren around the thing before "?"?
Taylor Brandstetter
2016/12/14 00:17:01
Done (but using std::min).
| |
2601 } | 2602 } |
2602 } | 2603 } |
2603 continue; | 2604 continue; |
2604 } | 2605 } |
2605 | 2606 |
2606 if (!IsLineType(line, kLineTypeAttributes)) { | 2607 if (!IsLineType(line, kLineTypeAttributes)) { |
2607 // TODO: Handle other lines if needed. | 2608 // TODO: Handle other lines if needed. |
2608 LOG(LS_INFO) << "Ignored line: " << line; | 2609 LOG(LS_INFO) << "Ignored line: " << line; |
2609 continue; | 2610 continue; |
2610 } | 2611 } |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3173 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( | 3174 UpdateCodec<AudioContentDescription, cricket::AudioCodec>( |
3174 media_desc, payload_type, feedback_param); | 3175 media_desc, payload_type, feedback_param); |
3175 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { | 3176 } else if (media_type == cricket::MEDIA_TYPE_VIDEO) { |
3176 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( | 3177 UpdateCodec<VideoContentDescription, cricket::VideoCodec>( |
3177 media_desc, payload_type, feedback_param); | 3178 media_desc, payload_type, feedback_param); |
3178 } | 3179 } |
3179 return true; | 3180 return true; |
3180 } | 3181 } |
3181 | 3182 |
3182 } // namespace webrtc | 3183 } // namespace webrtc |
OLD | NEW |