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