| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return config; | 174 return config; |
| 175 } | 175 } |
| 176 | 176 |
| 177 // |max_send_bitrate_bps| is the bitrate from "b=" in SDP. | 177 // |max_send_bitrate_bps| is the bitrate from "b=" in SDP. |
| 178 // |rtp_max_bitrate_bps| is the bitrate from RtpSender::SetParameters. | 178 // |rtp_max_bitrate_bps| is the bitrate from RtpSender::SetParameters. |
| 179 rtc::Optional<int> ComputeSendBitrate(int max_send_bitrate_bps, | 179 rtc::Optional<int> ComputeSendBitrate(int max_send_bitrate_bps, |
| 180 rtc::Optional<int> rtp_max_bitrate_bps, | 180 rtc::Optional<int> rtp_max_bitrate_bps, |
| 181 const webrtc::AudioCodecSpec& spec) { | 181 const webrtc::AudioCodecSpec& spec) { |
| 182 // If application-configured bitrate is set, take minimum of that and SDP | 182 // If application-configured bitrate is set, take minimum of that and SDP |
| 183 // bitrate. | 183 // bitrate. |
| 184 const int bps = rtp_max_bitrate_bps | 184 const int bps = |
| 185 ? MinPositive(max_send_bitrate_bps, *rtp_max_bitrate_bps) | 185 rtp_max_bitrate_bps |
| 186 : max_send_bitrate_bps; | 186 ? webrtc::MinPositive(max_send_bitrate_bps, *rtp_max_bitrate_bps) |
| 187 : max_send_bitrate_bps; |
| 187 if (bps <= 0) { | 188 if (bps <= 0) { |
| 188 return rtc::Optional<int>(spec.info.default_bitrate_bps); | 189 return rtc::Optional<int>(spec.info.default_bitrate_bps); |
| 189 } | 190 } |
| 190 | 191 |
| 191 if (bps < spec.info.min_bitrate_bps) { | 192 if (bps < spec.info.min_bitrate_bps) { |
| 192 // If codec is not multi-rate and |bps| is less than the fixed bitrate then | 193 // If codec is not multi-rate and |bps| is less than the fixed bitrate then |
| 193 // fail. If codec is not multi-rate and |bps| exceeds or equal the fixed | 194 // fail. If codec is not multi-rate and |bps| exceeds or equal the fixed |
| 194 // bitrate then ignore. | 195 // bitrate then ignore. |
| 195 LOG(LS_ERROR) << "Failed to set codec " << spec.format.name | 196 LOG(LS_ERROR) << "Failed to set codec " << spec.format.name |
| 196 << " to bitrate " << bps << " bps" | 197 << " to bitrate " << bps << " bps" |
| (...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2341 ssrc); | 2342 ssrc); |
| 2342 if (it != unsignaled_recv_ssrcs_.end()) { | 2343 if (it != unsignaled_recv_ssrcs_.end()) { |
| 2343 unsignaled_recv_ssrcs_.erase(it); | 2344 unsignaled_recv_ssrcs_.erase(it); |
| 2344 return true; | 2345 return true; |
| 2345 } | 2346 } |
| 2346 return false; | 2347 return false; |
| 2347 } | 2348 } |
| 2348 } // namespace cricket | 2349 } // namespace cricket |
| 2349 | 2350 |
| 2350 #endif // HAVE_WEBRTC_VOICE | 2351 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |