Chromium Code Reviews| 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 if (IsCodec(*voe_codec, kG722CodecName)) { | 491 if (IsCodec(*voe_codec, kG722CodecName)) { |
| 492 // If the DCHECK triggers, the codec definition in WebRTC VoiceEngine | 492 // If the DCHECK triggers, the codec definition in WebRTC VoiceEngine |
| 493 // has changed, and this special case is no longer needed. | 493 // has changed, and this special case is no longer needed. |
| 494 RTC_DCHECK(voe_codec->plfreq != new_plfreq); | 494 RTC_DCHECK(voe_codec->plfreq != new_plfreq); |
| 495 voe_codec->plfreq = new_plfreq; | 495 voe_codec->plfreq = new_plfreq; |
| 496 } | 496 } |
| 497 } | 497 } |
| 498 }; | 498 }; |
| 499 | 499 |
| 500 const WebRtcVoiceCodecs::CodecPref WebRtcVoiceCodecs::kCodecPrefs[14] = { | 500 const WebRtcVoiceCodecs::CodecPref WebRtcVoiceCodecs::kCodecPrefs[14] = { |
| 501 #if WEBRTC_OPUS_SUPPORT_120MS_PTIME | |
| 502 {kOpusCodecName, 48000, 2, 111, true, {10, 20, 40, 60, 120}, | |
| 503 kOpusMaxBitrateBps}, | |
| 504 #else | |
| 501 {kOpusCodecName, 48000, 2, 111, true, {10, 20, 40, 60}, kOpusMaxBitrateBps}, | 505 {kOpusCodecName, 48000, 2, 111, true, {10, 20, 40, 60}, kOpusMaxBitrateBps}, |
| 506 #endif | |
| 502 {kIsacCodecName, 16000, 1, 103, true, {30, 60}, kIsacMaxBitrateBps}, | 507 {kIsacCodecName, 16000, 1, 103, true, {30, 60}, kIsacMaxBitrateBps}, |
| 503 {kIsacCodecName, 32000, 1, 104, true, {30}, kIsacMaxBitrateBps}, | 508 {kIsacCodecName, 32000, 1, 104, true, {30}, kIsacMaxBitrateBps}, |
| 504 // G722 should be advertised as 8000 Hz because of the RFC "bug". | 509 // G722 should be advertised as 8000 Hz because of the RFC "bug". |
| 505 {kG722CodecName, 8000, 1, 9, false, {10, 20, 30, 40, 50, 60}}, | 510 {kG722CodecName, 8000, 1, 9, false, {10, 20, 30, 40, 50, 60}}, |
| 506 {kIlbcCodecName, 8000, 1, 102, false, {20, 30, 40, 60}}, | 511 {kIlbcCodecName, 8000, 1, 102, false, {20, 30, 40, 60}}, |
| 507 {kPcmuCodecName, 8000, 1, 0, false, {10, 20, 30, 40, 50, 60}}, | 512 {kPcmuCodecName, 8000, 1, 0, false, {10, 20, 30, 40, 50, 60}}, |
| 508 {kPcmaCodecName, 8000, 1, 8, false, {10, 20, 30, 40, 50, 60}}, | 513 {kPcmaCodecName, 8000, 1, 8, false, {10, 20, 30, 40, 50, 60}}, |
| 509 {kCnCodecName, 32000, 1, 106, false, {}}, | 514 {kCnCodecName, 32000, 1, 106, false, {}}, |
| 510 {kCnCodecName, 16000, 1, 105, false, {}}, | 515 {kCnCodecName, 16000, 1, 105, false, {}}, |
| 511 {kCnCodecName, 8000, 1, 13, false, {}}, | 516 {kCnCodecName, 8000, 1, 13, false, {}}, |
| 512 {kDtmfCodecName, 48000, 1, 110, false, {}}, | 517 {kDtmfCodecName, 48000, 1, 110, false, {}}, |
| 513 {kDtmfCodecName, 32000, 1, 112, false, {}}, | 518 {kDtmfCodecName, 32000, 1, 112, false, {}}, |
| 514 {kDtmfCodecName, 16000, 1, 113, false, {}}, | 519 {kDtmfCodecName, 16000, 1, 113, false, {}}, |
| 515 {kDtmfCodecName, 8000, 1, 126, false, {}} | 520 {kDtmfCodecName, 8000, 1, 126, false, {}}}; |
| 516 }; | |
| 517 | 521 |
| 518 rtc::Optional<int> ComputeSendBitrate(int max_send_bitrate_bps, | 522 rtc::Optional<int> ComputeSendBitrate(int max_send_bitrate_bps, |
| 519 int rtp_max_bitrate_bps, | 523 int rtp_max_bitrate_bps, |
| 520 const webrtc::CodecInst& codec_inst) { | 524 const webrtc::CodecInst& codec_inst) { |
| 521 const int bps = MinPositive(max_send_bitrate_bps, rtp_max_bitrate_bps); | 525 const int bps = MinPositive(max_send_bitrate_bps, rtp_max_bitrate_bps); |
| 522 const int codec_rate = codec_inst.rate; | 526 const int codec_rate = codec_inst.rate; |
| 523 | 527 |
| 524 if (bps <= 0) { | 528 if (bps <= 0) { |
| 525 return rtc::Optional<int>(codec_rate); | 529 return rtc::Optional<int>(codec_rate); |
| 526 } | 530 } |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1466 if (!packet_sizes_ms.empty()) { | 1470 if (!packet_sizes_ms.empty()) { |
| 1467 int max_packet_size_ms = | 1471 int max_packet_size_ms = |
| 1468 *std::max_element(packet_sizes_ms.begin(), packet_sizes_ms.end()); | 1472 *std::max_element(packet_sizes_ms.begin(), packet_sizes_ms.end()); |
| 1469 int min_packet_size_ms = | 1473 int min_packet_size_ms = |
| 1470 *std::min_element(packet_sizes_ms.begin(), packet_sizes_ms.end()); | 1474 *std::min_element(packet_sizes_ms.begin(), packet_sizes_ms.end()); |
| 1471 | 1475 |
| 1472 // Audio network adaptor will just use 20ms and 60ms frame lengths. | 1476 // Audio network adaptor will just use 20ms and 60ms frame lengths. |
| 1473 // The adaptor will only be active for the Opus encoder. | 1477 // The adaptor will only be active for the Opus encoder. |
| 1474 if (config_.audio_network_adaptor_config && | 1478 if (config_.audio_network_adaptor_config && |
| 1475 IsCodec(config_.send_codec_spec.codec_inst, kOpusCodecName)) { | 1479 IsCodec(config_.send_codec_spec.codec_inst, kOpusCodecName)) { |
| 1476 max_packet_size_ms = 60; | 1480 max_packet_size_ms = 60; |
|
hlundin-webrtc
2017/02/01 14:12:34
Is this relevant to change?
michaelt
2017/02/01 15:01:08
Will be handled in https://codereview.webrtc.org/2
hlundin-webrtc
2017/02/01 15:10:59
Acknowledged.
| |
| 1477 min_packet_size_ms = 20; | 1481 min_packet_size_ms = 20; |
| 1478 } | 1482 } |
| 1479 | 1483 |
| 1480 // OverheadPerPacket = Ipv4(20B) + UDP(8B) + SRTP(10B) + RTP(12) | 1484 // OverheadPerPacket = Ipv4(20B) + UDP(8B) + SRTP(10B) + RTP(12) |
| 1481 constexpr int kOverheadPerPacket = 20 + 8 + 10 + 12; | 1485 constexpr int kOverheadPerPacket = 20 + 8 + 10 + 12; |
| 1482 | 1486 |
| 1483 int min_overhead_bps = | 1487 int min_overhead_bps = |
| 1484 kOverheadPerPacket * 8 * 1000 / max_packet_size_ms; | 1488 kOverheadPerPacket * 8 * 1000 / max_packet_size_ms; |
| 1485 | 1489 |
| 1486 int max_overhead_bps = | 1490 int max_overhead_bps = |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2705 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2709 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2706 const auto it = send_streams_.find(ssrc); | 2710 const auto it = send_streams_.find(ssrc); |
| 2707 if (it != send_streams_.end()) { | 2711 if (it != send_streams_.end()) { |
| 2708 return it->second->channel(); | 2712 return it->second->channel(); |
| 2709 } | 2713 } |
| 2710 return -1; | 2714 return -1; |
| 2711 } | 2715 } |
| 2712 } // namespace cricket | 2716 } // namespace cricket |
| 2713 | 2717 |
| 2714 #endif // HAVE_WEBRTC_VOICE | 2718 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |