OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
11 #include <string.h> | 11 #include <string.h> |
12 | 12 |
| 13 #include <algorithm> |
13 #include <map> | 14 #include <map> |
14 #include <memory> | 15 #include <memory> |
15 #include <vector> | 16 #include <vector> |
16 | 17 |
17 #include "webrtc/audio/audio_receive_stream.h" | 18 #include "webrtc/audio/audio_receive_stream.h" |
18 #include "webrtc/audio/audio_send_stream.h" | 19 #include "webrtc/audio/audio_send_stream.h" |
19 #include "webrtc/audio/audio_state.h" | 20 #include "webrtc/audio/audio_state.h" |
20 #include "webrtc/audio/scoped_voe_interface.h" | 21 #include "webrtc/audio/scoped_voe_interface.h" |
21 #include "webrtc/base/checks.h" | 22 #include "webrtc/base/checks.h" |
22 #include "webrtc/base/constructormagic.h" | 23 #include "webrtc/base/constructormagic.h" |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 uint32_t pacer_bitrate_bps = | 694 uint32_t pacer_bitrate_bps = |
694 std::max(target_bitrate_bps, allocated_bitrate_bps); | 695 std::max(target_bitrate_bps, allocated_bitrate_bps); |
695 { | 696 { |
696 rtc::CritScope lock(&bitrate_crit_); | 697 rtc::CritScope lock(&bitrate_crit_); |
697 // We only update these stats if we have send streams, and assume that | 698 // We only update these stats if we have send streams, and assume that |
698 // OnNetworkChanged is called roughly with a fixed frequency. | 699 // OnNetworkChanged is called roughly with a fixed frequency. |
699 estimated_send_bitrate_sum_kbits_ += target_bitrate_bps / 1000; | 700 estimated_send_bitrate_sum_kbits_ += target_bitrate_bps / 1000; |
700 pacer_bitrate_sum_kbits_ += pacer_bitrate_bps / 1000; | 701 pacer_bitrate_sum_kbits_ += pacer_bitrate_bps / 1000; |
701 ++num_bitrate_updates_; | 702 ++num_bitrate_updates_; |
702 } | 703 } |
| 704 |
| 705 // Make sure to not ask for more padding than the current BWE allows for. |
| 706 pad_up_to_bitrate_bps = std::min(static_cast<uint32_t>(pad_up_to_bitrate_bps), |
| 707 target_bitrate_bps); |
703 congestion_controller_->SetAllocatedSendBitrate(allocated_bitrate_bps, | 708 congestion_controller_->SetAllocatedSendBitrate(allocated_bitrate_bps, |
704 pad_up_to_bitrate_bps); | 709 pad_up_to_bitrate_bps); |
705 } | 710 } |
706 | 711 |
707 void Call::ConfigureSync(const std::string& sync_group) { | 712 void Call::ConfigureSync(const std::string& sync_group) { |
708 // Set sync only if there was no previous one. | 713 // Set sync only if there was no previous one. |
709 if (voice_engine() == nullptr || sync_group.empty()) | 714 if (voice_engine() == nullptr || sync_group.empty()) |
710 return; | 715 return; |
711 | 716 |
712 AudioReceiveStream* sync_audio_stream = nullptr; | 717 AudioReceiveStream* sync_audio_stream = nullptr; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 // thread. Then this check can be enabled. | 853 // thread. Then this check can be enabled. |
849 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 854 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
850 if (RtpHeaderParser::IsRtcp(packet, length)) | 855 if (RtpHeaderParser::IsRtcp(packet, length)) |
851 return DeliverRtcp(media_type, packet, length); | 856 return DeliverRtcp(media_type, packet, length); |
852 | 857 |
853 return DeliverRtp(media_type, packet, length, packet_time); | 858 return DeliverRtp(media_type, packet, length, packet_time); |
854 } | 859 } |
855 | 860 |
856 } // namespace internal | 861 } // namespace internal |
857 } // namespace webrtc | 862 } // namespace webrtc |
OLD | NEW |