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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 {kPcmaCodecName, 8000, 1, 8, false, {10, 20, 30, 40, 50, 60}}, | 508 {kPcmaCodecName, 8000, 1, 8, false, {10, 20, 30, 40, 50, 60}}, |
509 {kCnCodecName, 32000, 1, 106, false, {}}, | 509 {kCnCodecName, 32000, 1, 106, false, {}}, |
510 {kCnCodecName, 16000, 1, 105, false, {}}, | 510 {kCnCodecName, 16000, 1, 105, false, {}}, |
511 {kCnCodecName, 8000, 1, 13, false, {}}, | 511 {kCnCodecName, 8000, 1, 13, false, {}}, |
512 {kDtmfCodecName, 48000, 1, 110, false, {}}, | 512 {kDtmfCodecName, 48000, 1, 110, false, {}}, |
513 {kDtmfCodecName, 32000, 1, 112, false, {}}, | 513 {kDtmfCodecName, 32000, 1, 112, false, {}}, |
514 {kDtmfCodecName, 16000, 1, 113, false, {}}, | 514 {kDtmfCodecName, 16000, 1, 113, false, {}}, |
515 {kDtmfCodecName, 8000, 1, 126, false, {}} | 515 {kDtmfCodecName, 8000, 1, 126, false, {}} |
516 }; | 516 }; |
517 | 517 |
| 518 // |max_send_bitrate_bps| is the bitrate from "b=" in SDP. |
| 519 // |rtp_max_bitrate_bps| is the bitrate from RtpSender::SetParameters. |
518 rtc::Optional<int> ComputeSendBitrate(int max_send_bitrate_bps, | 520 rtc::Optional<int> ComputeSendBitrate(int max_send_bitrate_bps, |
519 int rtp_max_bitrate_bps, | 521 rtc::Optional<int> rtp_max_bitrate_bps, |
520 const webrtc::CodecInst& codec_inst) { | 522 const webrtc::CodecInst& codec_inst) { |
521 const int bps = MinPositive(max_send_bitrate_bps, rtp_max_bitrate_bps); | 523 // If application-configured bitrate is set, take minimum of that and SDP |
| 524 // bitrate. |
| 525 const int bps = rtp_max_bitrate_bps |
| 526 ? MinPositive(max_send_bitrate_bps, *rtp_max_bitrate_bps) |
| 527 : max_send_bitrate_bps; |
522 const int codec_rate = codec_inst.rate; | 528 const int codec_rate = codec_inst.rate; |
523 | 529 |
524 if (bps <= 0) { | 530 if (bps <= 0) { |
525 return rtc::Optional<int>(codec_rate); | 531 return rtc::Optional<int>(codec_rate); |
526 } | 532 } |
527 | 533 |
528 if (codec_inst.pltype == -1) { | 534 if (codec_inst.pltype == -1) { |
529 return rtc::Optional<int>(codec_rate); | 535 return rtc::Optional<int>(codec_rate); |
530 ; | 536 ; |
531 } | 537 } |
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2703 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2709 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
2704 const auto it = send_streams_.find(ssrc); | 2710 const auto it = send_streams_.find(ssrc); |
2705 if (it != send_streams_.end()) { | 2711 if (it != send_streams_.end()) { |
2706 return it->second->channel(); | 2712 return it->second->channel(); |
2707 } | 2713 } |
2708 return -1; | 2714 return -1; |
2709 } | 2715 } |
2710 } // namespace cricket | 2716 } // namespace cricket |
2711 | 2717 |
2712 #endif // HAVE_WEBRTC_VOICE | 2718 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |