OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 | 240 |
241 void SetTransportFeedbackObserver( | 241 void SetTransportFeedbackObserver( |
242 TransportFeedbackObserver* feedback_observer) { | 242 TransportFeedbackObserver* feedback_observer) { |
243 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 243 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
244 rtc::CritScope lock(&crit_); | 244 rtc::CritScope lock(&crit_); |
245 feedback_observer_ = feedback_observer; | 245 feedback_observer_ = feedback_observer; |
246 } | 246 } |
247 | 247 |
248 // Implements TransportFeedbackObserver. | 248 // Implements TransportFeedbackObserver. |
249 void AddPacket(uint16_t sequence_number, | 249 void AddPacket(uint32_t ssrc, |
| 250 uint16_t sequence_number, |
250 size_t length, | 251 size_t length, |
251 const PacedPacketInfo& pacing_info) override { | 252 const PacedPacketInfo& pacing_info) override { |
252 RTC_DCHECK(pacer_thread_.CalledOnValidThread()); | 253 RTC_DCHECK(pacer_thread_.CalledOnValidThread()); |
253 rtc::CritScope lock(&crit_); | 254 rtc::CritScope lock(&crit_); |
254 if (feedback_observer_) | 255 if (feedback_observer_) |
255 feedback_observer_->AddPacket(sequence_number, length, pacing_info); | 256 feedback_observer_->AddPacket(ssrc, sequence_number, length, pacing_info); |
256 } | 257 } |
257 | 258 |
258 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override { | 259 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override { |
259 RTC_DCHECK(network_thread_.CalledOnValidThread()); | 260 RTC_DCHECK(network_thread_.CalledOnValidThread()); |
260 rtc::CritScope lock(&crit_); | 261 rtc::CritScope lock(&crit_); |
261 if (feedback_observer_) | 262 if (feedback_observer_) |
262 feedback_observer_->OnTransportFeedback(feedback); | 263 feedback_observer_->OnTransportFeedback(feedback); |
263 } | 264 } |
264 std::vector<PacketFeedback> GetTransportFeedbackVector() const override { | 265 std::vector<PacketFeedback> GetTransportFeedbackVector() const override { |
265 RTC_NOTREACHED(); | 266 RTC_NOTREACHED(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 389 |
389 extended_max_sequence_number_[block_it->sourceSSRC] = | 390 extended_max_sequence_number_[block_it->sourceSSRC] = |
390 block_it->extendedHighSeqNum; | 391 block_it->extendedHighSeqNum; |
391 } | 392 } |
392 int weighted_fraction_lost = 0; | 393 int weighted_fraction_lost = 0; |
393 if (total_number_of_packets > 0) { | 394 if (total_number_of_packets > 0) { |
394 weighted_fraction_lost = | 395 weighted_fraction_lost = |
395 (fraction_lost_aggregate + total_number_of_packets / 2) / | 396 (fraction_lost_aggregate + total_number_of_packets / 2) / |
396 total_number_of_packets; | 397 total_number_of_packets; |
397 } | 398 } |
398 owner_->OnIncomingFractionLoss(weighted_fraction_lost); | 399 owner_->OnUplinkPacketLossRate(weighted_fraction_lost / 255.0f); |
399 } | 400 } |
400 | 401 |
401 private: | 402 private: |
402 Channel* owner_; | 403 Channel* owner_; |
403 // Maps remote side ssrc to extended highest sequence number received. | 404 // Maps remote side ssrc to extended highest sequence number received. |
404 std::map<uint32_t, uint32_t> extended_max_sequence_number_; | 405 std::map<uint32_t, uint32_t> extended_max_sequence_number_; |
405 rtc::CriticalSection crit_; | 406 rtc::CriticalSection crit_; |
406 RtcpBandwidthObserver* bandwidth_observer_ GUARDED_BY(crit_); | 407 RtcpBandwidthObserver* bandwidth_observer_ GUARDED_BY(crit_); |
407 }; | 408 }; |
408 | 409 |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 _outputSpeechType(AudioFrame::kNormalSpeech), | 896 _outputSpeechType(AudioFrame::kNormalSpeech), |
896 restored_packet_in_use_(false), | 897 restored_packet_in_use_(false), |
897 rtcp_observer_(new VoERtcpObserver(this)), | 898 rtcp_observer_(new VoERtcpObserver(this)), |
898 associate_send_channel_(ChannelOwner(nullptr)), | 899 associate_send_channel_(ChannelOwner(nullptr)), |
899 pacing_enabled_(config.enable_voice_pacing), | 900 pacing_enabled_(config.enable_voice_pacing), |
900 feedback_observer_proxy_(new TransportFeedbackProxy()), | 901 feedback_observer_proxy_(new TransportFeedbackProxy()), |
901 seq_num_allocator_proxy_(new TransportSequenceNumberProxy()), | 902 seq_num_allocator_proxy_(new TransportSequenceNumberProxy()), |
902 rtp_packet_sender_proxy_(new RtpPacketSenderProxy()), | 903 rtp_packet_sender_proxy_(new RtpPacketSenderProxy()), |
903 retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(), | 904 retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(), |
904 kMaxRetransmissionWindowMs)), | 905 kMaxRetransmissionWindowMs)), |
905 decoder_factory_(config.acm_config.decoder_factory) { | 906 decoder_factory_(config.acm_config.decoder_factory), |
| 907 // TODO(elad.alon): Subsequent CL experiments with PLR source. |
| 908 use_twcc_plr_for_ana_(false) { |
906 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId), | 909 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId), |
907 "Channel::Channel() - ctor"); | 910 "Channel::Channel() - ctor"); |
908 AudioCodingModule::Config acm_config(config.acm_config); | 911 AudioCodingModule::Config acm_config(config.acm_config); |
909 acm_config.id = VoEModuleId(instanceId, channelId); | 912 acm_config.id = VoEModuleId(instanceId, channelId); |
910 acm_config.neteq_config.enable_muted_state = true; | 913 acm_config.neteq_config.enable_muted_state = true; |
911 audio_coding_.reset(AudioCodingModule::Create(acm_config)); | 914 audio_coding_.reset(AudioCodingModule::Create(acm_config)); |
912 | 915 |
913 _outputAudioLevel.Clear(); | 916 _outputAudioLevel.Clear(); |
914 | 917 |
915 RtpRtcp::Configuration configuration; | 918 RtpRtcp::Configuration configuration; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 "Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps); | 1297 "Channel::SetBitRate(bitrate_bps=%d)", bitrate_bps); |
1295 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | 1298 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
1296 if (*encoder) { | 1299 if (*encoder) { |
1297 (*encoder)->OnReceivedUplinkBandwidth( | 1300 (*encoder)->OnReceivedUplinkBandwidth( |
1298 bitrate_bps, rtc::Optional<int64_t>(probing_interval_ms)); | 1301 bitrate_bps, rtc::Optional<int64_t>(probing_interval_ms)); |
1299 } | 1302 } |
1300 }); | 1303 }); |
1301 retransmission_rate_limiter_->SetMaxRate(bitrate_bps); | 1304 retransmission_rate_limiter_->SetMaxRate(bitrate_bps); |
1302 } | 1305 } |
1303 | 1306 |
1304 void Channel::OnIncomingFractionLoss(int fraction_lost) { | 1307 void Channel::OnTwccBasedUplinkPacketLossRate(float packet_loss_rate) { |
| 1308 if (!use_twcc_plr_for_ana_) |
| 1309 return; |
1305 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { | 1310 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
1306 if (*encoder) | 1311 if (*encoder) |
1307 (*encoder)->OnReceivedUplinkPacketLossFraction(fraction_lost / 255.0f); | 1312 (*encoder)->OnReceivedUplinkPacketLossFraction(packet_loss_rate); |
1308 }); | 1313 }); |
1309 } | 1314 } |
1310 | 1315 |
| 1316 void Channel::OnUplinkPacketLossRate(float packet_loss_rate) { |
| 1317 if (use_twcc_plr_for_ana_) |
| 1318 return; |
| 1319 audio_coding_->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder) { |
| 1320 if (*encoder) { |
| 1321 (*encoder)->OnReceivedUplinkPacketLossFraction(packet_loss_rate); |
| 1322 } |
| 1323 }); |
| 1324 } |
| 1325 |
1311 int32_t Channel::SetVADStatus(bool enableVAD, | 1326 int32_t Channel::SetVADStatus(bool enableVAD, |
1312 ACMVADMode mode, | 1327 ACMVADMode mode, |
1313 bool disableDTX) { | 1328 bool disableDTX) { |
1314 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), | 1329 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), |
1315 "Channel::SetVADStatus(mode=%d)", mode); | 1330 "Channel::SetVADStatus(mode=%d)", mode); |
1316 RTC_DCHECK(!(disableDTX && enableVAD)); // disableDTX mode is deprecated. | 1331 RTC_DCHECK(!(disableDTX && enableVAD)); // disableDTX mode is deprecated. |
1317 if (!codec_manager_.SetVAD(enableVAD, mode) || | 1332 if (!codec_manager_.SetVAD(enableVAD, mode) || |
1318 !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get())) { | 1333 !codec_manager_.MakeEncoder(&rent_a_codec_, audio_coding_.get())) { |
1319 _engineStatisticsPtr->SetLastError(VE_AUDIO_CODING_MODULE_ERROR, | 1334 _engineStatisticsPtr->SetLastError(VE_AUDIO_CODING_MODULE_ERROR, |
1320 kTraceError, | 1335 kTraceError, |
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 int64_t min_rtt = 0; | 3018 int64_t min_rtt = 0; |
3004 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3019 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3005 0) { | 3020 0) { |
3006 return 0; | 3021 return 0; |
3007 } | 3022 } |
3008 return rtt; | 3023 return rtt; |
3009 } | 3024 } |
3010 | 3025 |
3011 } // namespace voe | 3026 } // namespace voe |
3012 } // namespace webrtc | 3027 } // namespace webrtc |
OLD | NEW |