OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 18 matching lines...) Expand all Loading... |
29 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont
roller.h" | 29 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont
roller.h" |
30 #include "webrtc/modules/pacing/paced_sender.h" | 30 #include "webrtc/modules/pacing/paced_sender.h" |
31 #include "webrtc/voice_engine/channel_proxy.h" | 31 #include "webrtc/voice_engine/channel_proxy.h" |
32 #include "webrtc/voice_engine/include/voe_base.h" | 32 #include "webrtc/voice_engine/include/voe_base.h" |
33 #include "webrtc/voice_engine/transmit_mixer.h" | 33 #include "webrtc/voice_engine/transmit_mixer.h" |
34 #include "webrtc/voice_engine/voice_engine_impl.h" | 34 #include "webrtc/voice_engine/voice_engine_impl.h" |
35 | 35 |
36 namespace webrtc { | 36 namespace webrtc { |
37 | 37 |
38 namespace internal { | 38 namespace internal { |
39 // TODO(elad.alon): Subsequent CL will make these values experiment-dependent. | 39 // TODO(eladalon): Subsequent CL will make these values experiment-dependent. |
40 constexpr size_t kPacketLossTrackerMaxWindowSizeMs = 15000; | 40 constexpr size_t kPacketLossTrackerMaxWindowSizeMs = 15000; |
41 constexpr size_t kPacketLossRateMinNumAckedPackets = 50; | 41 constexpr size_t kPacketLossRateMinNumAckedPackets = 50; |
42 constexpr size_t kRecoverablePacketLossRateMinNumAckedPairs = 40; | 42 constexpr size_t kRecoverablePacketLossRateMinNumAckedPairs = 40; |
43 | 43 |
44 namespace { | 44 namespace { |
45 void CallEncoder(const std::unique_ptr<voe::ChannelProxy>& channel_proxy, | 45 void CallEncoder(const std::unique_ptr<voe::ChannelProxy>& channel_proxy, |
46 rtc::FunctionView<void(AudioEncoder*)> lambda) { | 46 rtc::FunctionView<void(AudioEncoder*)> lambda) { |
47 channel_proxy->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder_ptr) { | 47 channel_proxy->ModifyEncoder([&](std::unique_ptr<AudioEncoder>* encoder_ptr) { |
48 RTC_DCHECK(encoder_ptr); | 48 RTC_DCHECK(encoder_ptr); |
49 lambda(encoder_ptr->get()); | 49 lambda(encoder_ptr->get()); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // The amount of audio protection is not exposed by the encoder, hence | 333 // The amount of audio protection is not exposed by the encoder, hence |
334 // always returning 0. | 334 // always returning 0. |
335 return 0; | 335 return 0; |
336 } | 336 } |
337 | 337 |
338 void AudioSendStream::OnPacketAdded(uint32_t ssrc, uint16_t seq_num) { | 338 void AudioSendStream::OnPacketAdded(uint32_t ssrc, uint16_t seq_num) { |
339 RTC_DCHECK(pacer_thread_checker_.CalledOnValidThread()); | 339 RTC_DCHECK(pacer_thread_checker_.CalledOnValidThread()); |
340 // Only packets that belong to this stream are of interest. | 340 // Only packets that belong to this stream are of interest. |
341 if (ssrc == config_.rtp.ssrc) { | 341 if (ssrc == config_.rtp.ssrc) { |
342 rtc::CritScope lock(&packet_loss_tracker_cs_); | 342 rtc::CritScope lock(&packet_loss_tracker_cs_); |
343 // TODO(elad.alon): This function call could potentially reset the window, | 343 // TODO(eladalon): This function call could potentially reset the window, |
344 // setting both PLR and RPLR to unknown. Consider (during upcoming | 344 // setting both PLR and RPLR to unknown. Consider (during upcoming |
345 // refactoring) passing an indication of such an event. | 345 // refactoring) passing an indication of such an event. |
346 packet_loss_tracker_.OnPacketAdded(seq_num, rtc::TimeMillis()); | 346 packet_loss_tracker_.OnPacketAdded(seq_num, rtc::TimeMillis()); |
347 } | 347 } |
348 } | 348 } |
349 | 349 |
350 void AudioSendStream::OnPacketFeedbackVector( | 350 void AudioSendStream::OnPacketFeedbackVector( |
351 const std::vector<PacketFeedback>& packet_feedback_vector) { | 351 const std::vector<PacketFeedback>& packet_feedback_vector) { |
352 // TODO(elad.alon): This fails in UT; fix and uncomment. | 352 // TODO(eladalon): This fails in UT; fix and uncomment. |
353 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=7405 | 353 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=7405 |
354 // RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 354 // RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
355 rtc::Optional<float> plr; | 355 rtc::Optional<float> plr; |
356 rtc::Optional<float> rplr; | 356 rtc::Optional<float> rplr; |
357 { | 357 { |
358 rtc::CritScope lock(&packet_loss_tracker_cs_); | 358 rtc::CritScope lock(&packet_loss_tracker_cs_); |
359 packet_loss_tracker_.OnPacketFeedbackVector(packet_feedback_vector); | 359 packet_loss_tracker_.OnPacketFeedbackVector(packet_feedback_vector); |
360 plr = packet_loss_tracker_.GetPacketLossRate(); | 360 plr = packet_loss_tracker_.GetPacketLossRate(); |
361 rplr = packet_loss_tracker_.GetRecoverablePacketLossRate(); | 361 rplr = packet_loss_tracker_.GetRecoverablePacketLossRate(); |
362 } | 362 } |
363 // TODO(elad.alon): If R/PLR go back to unknown, no indication is given that | 363 // TODO(eladalon): If R/PLR go back to unknown, no indication is given that |
364 // the previously sent value is no longer relevant. This will be taken care | 364 // the previously sent value is no longer relevant. This will be taken care |
365 // of with some refactoring which is now being done. | 365 // of with some refactoring which is now being done. |
366 if (plr) { | 366 if (plr) { |
367 channel_proxy_->OnTwccBasedUplinkPacketLossRate(*plr); | 367 channel_proxy_->OnTwccBasedUplinkPacketLossRate(*plr); |
368 } | 368 } |
369 if (rplr) { | 369 if (rplr) { |
370 channel_proxy_->OnRecoverableUplinkPacketLossRate(*rplr); | 370 channel_proxy_->OnRecoverableUplinkPacketLossRate(*rplr); |
371 } | 371 } |
372 } | 372 } |
373 | 373 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 if (rtp_rtcp_module_->RegisterSendPayload(codec) != 0) { | 606 if (rtp_rtcp_module_->RegisterSendPayload(codec) != 0) { |
607 LOG(LS_ERROR) << "RegisterCngPayloadType() failed to register CN to " | 607 LOG(LS_ERROR) << "RegisterCngPayloadType() failed to register CN to " |
608 "RTP/RTCP module"; | 608 "RTP/RTCP module"; |
609 } | 609 } |
610 } | 610 } |
611 } | 611 } |
612 | 612 |
613 | 613 |
614 } // namespace internal | 614 } // namespace internal |
615 } // namespace webrtc | 615 } // namespace webrtc |
OLD | NEW |