diff options
Diffstat (limited to 'third_party/libwebrtc/modules/congestion_controller')
6 files changed, 21 insertions, 30 deletions
diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_unittest_helper.cc b/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_unittest_helper.cc index 16bd4153a6..e56aa4a09c 100644 --- a/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_unittest_helper.cc +++ b/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_unittest_helper.cc @@ -26,6 +26,7 @@ #include "modules/congestion_controller/goog_cc/probe_bitrate_estimator.h" #include "rtc_base/checks.h" #include "test/field_trial.h" +#include "test/gtest.h" namespace webrtc { constexpr size_t kMtu = 1200; @@ -52,6 +53,7 @@ RtpStream::RtpStream(int fps, int bitrate_bps) // previous frame, no frame will be generated. The frame is split into // packets. int64_t RtpStream::GenerateFrame(int64_t time_now_us, + int64_t* next_sequence_number, std::vector<PacketResult>* packets) { if (time_now_us < next_rtp_time_) { return next_rtp_time_; @@ -66,6 +68,7 @@ int64_t RtpStream::GenerateFrame(int64_t time_now_us, packet.sent_packet.send_time = Timestamp::Micros(time_now_us + kSendSideOffsetUs); packet.sent_packet.size = DataSize::Bytes(payload_size); + packet.sent_packet.sequence_number = (*next_sequence_number)++; packets->push_back(packet); } next_rtp_time_ = time_now_us + (1000000 + fps_ / 2) / fps_; @@ -131,14 +134,15 @@ void StreamGenerator::SetBitrateBps(int bitrate_bps) { // TODO(holmer): Break out the channel simulation part from this class to make // it possible to simulate different types of channels. -int64_t StreamGenerator::GenerateFrame(std::vector<PacketResult>* packets, - int64_t time_now_us) { +int64_t StreamGenerator::GenerateFrame(int64_t time_now_us, + int64_t* next_sequence_number, + std::vector<PacketResult>* packets) { RTC_CHECK(packets != NULL); RTC_CHECK(packets->empty()); RTC_CHECK_GT(capacity_, 0); auto it = std::min_element(streams_.begin(), streams_.end(), RtpStream::Compare); - (*it)->GenerateFrame(time_now_us, packets); + (*it)->GenerateFrame(time_now_us, next_sequence_number, packets); for (PacketResult& packet : *packets) { int capacity_bpus = capacity_ / 1000; int64_t required_network_time_us = @@ -233,8 +237,8 @@ bool DelayBasedBweTest::GenerateAndProcessFrame(uint32_t ssrc, stream_generator_->SetBitrateBps(bitrate_bps); std::vector<PacketResult> packets; - int64_t next_time_us = - stream_generator_->GenerateFrame(&packets, clock_.TimeInMicroseconds()); + int64_t next_time_us = stream_generator_->GenerateFrame( + clock_.TimeInMicroseconds(), &next_sequence_number_, &packets); if (packets.empty()) return false; diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_unittest_helper.h b/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_unittest_helper.h index 89eb1a353f..634e6a4d82 100644 --- a/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_unittest_helper.h +++ b/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_unittest_helper.h @@ -15,12 +15,11 @@ #include <stdint.h> #include <memory> -#include <string> #include <vector> -#include "absl/strings/string_view.h" #include "api/transport/field_trial_based_config.h" #include "api/transport/network_types.h" +#include "api/units/timestamp.h" #include "modules/congestion_controller/goog_cc/acknowledged_bitrate_estimator.h" #include "modules/congestion_controller/goog_cc/delay_based_bwe.h" #include "system_wrappers/include/clock.h" @@ -61,6 +60,7 @@ class RtpStream { // previous frame, no frame will be generated. The frame is split into // packets. int64_t GenerateFrame(int64_t time_now_us, + int64_t* next_sequence_number, std::vector<PacketResult>* packets); // The send-side time when the next frame can be generated. @@ -102,8 +102,9 @@ class StreamGenerator { // TODO(holmer): Break out the channel simulation part from this class to make // it possible to simulate different types of channels. - int64_t GenerateFrame(std::vector<PacketResult>* packets, - int64_t time_now_us); + int64_t GenerateFrame(int64_t time_now_us, + int64_t* next_sequence_number, + std::vector<PacketResult>* packets); private: // Capacity of the simulated channel in bits per second. diff --git a/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc b/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc index 22693d67e9..211d86c95d 100644 --- a/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc +++ b/third_party/libwebrtc/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc @@ -281,7 +281,8 @@ void SendSideBandwidthEstimation::OnRouteChange() { uma_update_state_ = kNoUpdate; uma_rtt_state_ = kNoUpdate; last_rtc_event_log_ = Timestamp::MinusInfinity(); - if (loss_based_bandwidth_estimator_v2_->UseInStartPhase()) { + if (LossBasedBandwidthEstimatorV2Enabled() && + loss_based_bandwidth_estimator_v2_->UseInStartPhase()) { loss_based_bandwidth_estimator_v2_.reset( new LossBasedBweV2(key_value_config_)); } diff --git a/third_party/libwebrtc/modules/congestion_controller/rtp/BUILD.gn b/third_party/libwebrtc/modules/congestion_controller/rtp/BUILD.gn index cd13332b7f..8ec755e1aa 100644 --- a/third_party/libwebrtc/modules/congestion_controller/rtp/BUILD.gn +++ b/third_party/libwebrtc/modules/congestion_controller/rtp/BUILD.gn @@ -34,7 +34,6 @@ rtc_library("control_handler") { "../../../rtc_base:safe_conversions", "../../../rtc_base:safe_minmax", "../../../rtc_base/system:no_unique_address", - "../../../system_wrappers:field_trial", "../../pacing", ] absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ] diff --git a/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler.cc b/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler.cc index da6451c97e..357a0f0798 100644 --- a/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler.cc +++ b/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler.cc @@ -18,21 +18,8 @@ #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_conversions.h" #include "rtc_base/numerics/safe_minmax.h" -#include "system_wrappers/include/field_trial.h" namespace webrtc { -namespace { - -// By default, pacer emergency stops encoder when buffer reaches a high level. -bool IsPacerEmergencyStopDisabled() { - return field_trial::IsEnabled("WebRTC-DisablePacerEmergencyStop"); -} - -} // namespace -CongestionControlHandler::CongestionControlHandler() - : disable_pacer_emergency_stop_(IsPacerEmergencyStopDisabled()) {} - -CongestionControlHandler::~CongestionControlHandler() {} void CongestionControlHandler::SetTargetRate( TargetTransferRate new_target_rate) { @@ -60,9 +47,8 @@ absl::optional<TargetTransferRate> CongestionControlHandler::GetUpdate() { bool pause_encoding = false; if (!network_available_) { pause_encoding = true; - } else if (!disable_pacer_emergency_stop_ && - pacer_expected_queue_ms_ > - PacingController::kMaxExpectedQueueLength.ms()) { + } else if (pacer_expected_queue_ms_ > + PacingController::kMaxExpectedQueueLength.ms()) { pause_encoding = true; } if (pause_encoding) diff --git a/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler.h b/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler.h index d8e7263a02..649d2f911e 100644 --- a/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler.h +++ b/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler.h @@ -28,12 +28,13 @@ namespace webrtc { // destruction unless members are properly ordered. class CongestionControlHandler { public: - CongestionControlHandler(); - ~CongestionControlHandler(); + CongestionControlHandler() = default; CongestionControlHandler(const CongestionControlHandler&) = delete; CongestionControlHandler& operator=(const CongestionControlHandler&) = delete; + ~CongestionControlHandler() = default; + void SetTargetRate(TargetTransferRate new_target_rate); void SetNetworkAvailability(bool network_available); void SetPacerQueue(TimeDelta expected_queue_time); @@ -45,7 +46,6 @@ class CongestionControlHandler { bool network_available_ = true; bool encoder_paused_in_last_report_ = false; - const bool disable_pacer_emergency_stop_; int64_t pacer_expected_queue_ms_ = 0; RTC_NO_UNIQUE_ADDRESS SequenceChecker sequenced_checker_; |