diff --git a/modules/pacing/paced_sender.cc b/modules/pacing/paced_sender.cc index 609c9b4ec2..8827cf00a3 100644 --- a/modules/pacing/paced_sender.cc +++ b/modules/pacing/paced_sender.cc @@ -96,7 +96,7 @@ PacedSender::PacedSender(Clock* clock, pacing_bitrate_(DataRate::Zero()), time_last_process_us_(clock->TimeInMicroseconds()), last_send_time_us_(clock->TimeInMicroseconds()), - packets_(clock->TimeInMicroseconds()), + packets_(clock->TimeInMicroseconds(), field_trials), packet_counter_(0), congestion_window_size_(DataSize::PlusInfinity()), outstanding_data_(DataSize::Zero()), diff --git a/modules/pacing/round_robin_packet_queue.cc b/modules/pacing/round_robin_packet_queue.cc index a1deb06239..c0c664b2d6 100644 --- a/modules/pacing/round_robin_packet_queue.cc +++ b/modules/pacing/round_robin_packet_queue.cc @@ -71,8 +71,19 @@ RoundRobinPacketQueue::Stream::Stream() : bytes(0), ssrc(0) {} RoundRobinPacketQueue::Stream::Stream(const Stream& stream) = default; RoundRobinPacketQueue::Stream::~Stream() {} -RoundRobinPacketQueue::RoundRobinPacketQueue(int64_t start_time_us) - : time_last_updated_ms_(start_time_us / 1000) {} +bool IsEnabled(const WebRtcKeyValueConfig* field_trials, const char* name) { + if (!field_trials) { + return false; + } + return field_trials->Lookup(name).find("Enabled") == 0; +} + +RoundRobinPacketQueue::RoundRobinPacketQueue( + int64_t start_time_us, + const WebRtcKeyValueConfig* field_trials) + : time_last_updated_ms_(start_time_us / 1000), + send_side_bwe_with_overhead_( + IsEnabled(field_trials, "WebRTC-SendSideBwe-WithOverhead")) {} RoundRobinPacketQueue::~RoundRobinPacketQueue() {} @@ -98,7 +109,9 @@ void RoundRobinPacketQueue::Push(int priority, uint32_t ssrc = packet->Ssrc(); uint16_t sequence_number = packet->SequenceNumber(); int64_t capture_time_ms = packet->capture_time_ms(); - size_t size_bytes = packet->payload_size() + packet->padding_size(); + size_t size_bytes = send_side_bwe_with_overhead_ + ? packet->size() + : packet->payload_size() + packet->padding_size(); auto type = packet->packet_type(); RTC_DCHECK(type.has_value()); diff --git a/modules/pacing/round_robin_packet_queue.h b/modules/pacing/round_robin_packet_queue.h index 4bab4fab99..c045be4ab6 100644 --- a/modules/pacing/round_robin_packet_queue.h +++ b/modules/pacing/round_robin_packet_queue.h @@ -21,6 +21,7 @@ #include #include "absl/types/optional.h" +#include "api/transport/webrtc_key_value_config.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/source/rtp_packet_to_send.h" #include "system_wrappers/include/clock.h" @@ -29,7 +30,8 @@ namespace webrtc { class RoundRobinPacketQueue { public: - explicit RoundRobinPacketQueue(int64_t start_time_us); + RoundRobinPacketQueue(int64_t start_time_us, + const WebRtcKeyValueConfig* field_trials); ~RoundRobinPacketQueue(); struct QueuedPacket { @@ -187,6 +189,8 @@ class RoundRobinPacketQueue { // end iterator of this list if queue does not have direct ownership of the // packet. std::list> rtp_packets_; + + const bool send_side_bwe_with_overhead_; }; } // namespace webrtc