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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 const std::string& c_name, | 1219 const std::string& c_name, |
1220 const webrtc::AudioSendStream::Config::SendCodecSpec& send_codec_spec, | 1220 const webrtc::AudioSendStream::Config::SendCodecSpec& send_codec_spec, |
1221 const std::vector<webrtc::RtpExtension>& extensions, | 1221 const std::vector<webrtc::RtpExtension>& extensions, |
1222 int max_send_bitrate_bps, | 1222 int max_send_bitrate_bps, |
1223 const rtc::Optional<std::string>& audio_network_adaptor_config, | 1223 const rtc::Optional<std::string>& audio_network_adaptor_config, |
1224 webrtc::Call* call, | 1224 webrtc::Call* call, |
1225 webrtc::Transport* send_transport) | 1225 webrtc::Transport* send_transport) |
1226 : voe_audio_transport_(voe_audio_transport), | 1226 : voe_audio_transport_(voe_audio_transport), |
1227 call_(call), | 1227 call_(call), |
1228 config_(send_transport), | 1228 config_(send_transport), |
| 1229 send_side_bwe_with_overhead_(webrtc::field_trial::FindFullName( |
| 1230 "WebRTC-SendSideBwe-WithOverhead") == "Enabled"), |
1229 max_send_bitrate_bps_(max_send_bitrate_bps), | 1231 max_send_bitrate_bps_(max_send_bitrate_bps), |
1230 rtp_parameters_(CreateRtpParametersWithOneEncoding()) { | 1232 rtp_parameters_(CreateRtpParametersWithOneEncoding()) { |
1231 RTC_DCHECK_GE(ch, 0); | 1233 RTC_DCHECK_GE(ch, 0); |
1232 // TODO(solenberg): Once we're not using FakeWebRtcVoiceEngine anymore: | 1234 // TODO(solenberg): Once we're not using FakeWebRtcVoiceEngine anymore: |
1233 // RTC_DCHECK(voe_audio_transport); | 1235 // RTC_DCHECK(voe_audio_transport); |
1234 RTC_DCHECK(call); | 1236 RTC_DCHECK(call); |
1235 config_.rtp.ssrc = ssrc; | 1237 config_.rtp.ssrc = ssrc; |
1236 config_.rtp.c_name = c_name; | 1238 config_.rtp.c_name = c_name; |
1237 config_.voe_channel_id = ch; | 1239 config_.voe_channel_id = ch; |
1238 config_.rtp.extensions = extensions; | 1240 config_.rtp.extensions = extensions; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 call_->DestroyAudioSendStream(stream_); | 1453 call_->DestroyAudioSendStream(stream_); |
1452 stream_ = nullptr; | 1454 stream_ = nullptr; |
1453 } | 1455 } |
1454 RTC_DCHECK(!stream_); | 1456 RTC_DCHECK(!stream_); |
1455 if (webrtc::field_trial::FindFullName("WebRTC-Audio-SendSideBwe") == | 1457 if (webrtc::field_trial::FindFullName("WebRTC-Audio-SendSideBwe") == |
1456 "Enabled") { | 1458 "Enabled") { |
1457 config_.min_bitrate_bps = kOpusMinBitrateBps; | 1459 config_.min_bitrate_bps = kOpusMinBitrateBps; |
1458 config_.max_bitrate_bps = kOpusBitrateFbBps; | 1460 config_.max_bitrate_bps = kOpusBitrateFbBps; |
1459 // TODO(mflodman): Keep testing this and set proper values. | 1461 // TODO(mflodman): Keep testing this and set proper values. |
1460 // Note: This is an early experiment currently only supported by Opus. | 1462 // Note: This is an early experiment currently only supported by Opus. |
1461 if (webrtc::field_trial::FindFullName( | 1463 if (send_side_bwe_with_overhead_) { |
1462 "WebRTC-SendSideBwe-WithOverhead") == "Enabled") { | |
1463 auto packet_sizes_ms = WebRtcVoiceCodecs::GetPacketSizesMs( | 1464 auto packet_sizes_ms = WebRtcVoiceCodecs::GetPacketSizesMs( |
1464 config_.send_codec_spec.codec_inst); | 1465 config_.send_codec_spec.codec_inst); |
1465 if (!packet_sizes_ms.empty()) { | 1466 if (!packet_sizes_ms.empty()) { |
1466 int max_packet_size_ms = | 1467 int max_packet_size_ms = |
1467 *std::max_element(packet_sizes_ms.begin(), packet_sizes_ms.end()); | 1468 *std::max_element(packet_sizes_ms.begin(), packet_sizes_ms.end()); |
1468 int min_packet_size_ms = | 1469 int min_packet_size_ms = |
1469 *std::min_element(packet_sizes_ms.begin(), packet_sizes_ms.end()); | 1470 *std::min_element(packet_sizes_ms.begin(), packet_sizes_ms.end()); |
1470 | 1471 |
1471 // Audio network adaptor will just use 20ms and 60ms frame lengths. | 1472 // Audio network adaptor will just use 20ms and 60ms frame lengths. |
1472 // The adaptor will only be active for the Opus encoder. | 1473 // The adaptor will only be active for the Opus encoder. |
(...skipping 20 matching lines...) Expand all Loading... |
1493 stream_ = call_->CreateAudioSendStream(config_); | 1494 stream_ = call_->CreateAudioSendStream(config_); |
1494 RTC_CHECK(stream_); | 1495 RTC_CHECK(stream_); |
1495 UpdateSendState(); | 1496 UpdateSendState(); |
1496 } | 1497 } |
1497 | 1498 |
1498 rtc::ThreadChecker worker_thread_checker_; | 1499 rtc::ThreadChecker worker_thread_checker_; |
1499 rtc::RaceChecker audio_capture_race_checker_; | 1500 rtc::RaceChecker audio_capture_race_checker_; |
1500 webrtc::AudioTransport* const voe_audio_transport_ = nullptr; | 1501 webrtc::AudioTransport* const voe_audio_transport_ = nullptr; |
1501 webrtc::Call* call_ = nullptr; | 1502 webrtc::Call* call_ = nullptr; |
1502 webrtc::AudioSendStream::Config config_; | 1503 webrtc::AudioSendStream::Config config_; |
| 1504 const bool send_side_bwe_with_overhead_; |
1503 // The stream is owned by WebRtcAudioSendStream and may be reallocated if | 1505 // The stream is owned by WebRtcAudioSendStream and may be reallocated if |
1504 // configuration changes. | 1506 // configuration changes. |
1505 webrtc::AudioSendStream* stream_ = nullptr; | 1507 webrtc::AudioSendStream* stream_ = nullptr; |
1506 | 1508 |
1507 // Raw pointer to AudioSource owned by LocalAudioTrackHandler. | 1509 // Raw pointer to AudioSource owned by LocalAudioTrackHandler. |
1508 // PeerConnection will make sure invalidating the pointer before the object | 1510 // PeerConnection will make sure invalidating the pointer before the object |
1509 // goes away. | 1511 // goes away. |
1510 AudioSource* source_ = nullptr; | 1512 AudioSource* source_ = nullptr; |
1511 bool send_ = false; | 1513 bool send_ = false; |
1512 bool muted_ = false; | 1514 bool muted_ = false; |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2703 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2705 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
2704 const auto it = send_streams_.find(ssrc); | 2706 const auto it = send_streams_.find(ssrc); |
2705 if (it != send_streams_.end()) { | 2707 if (it != send_streams_.end()) { |
2706 return it->second->channel(); | 2708 return it->second->channel(); |
2707 } | 2709 } |
2708 return -1; | 2710 return -1; |
2709 } | 2711 } |
2710 } // namespace cricket | 2712 } // namespace cricket |
2711 | 2713 |
2712 #endif // HAVE_WEBRTC_VOICE | 2714 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |