From 7702c8ac0420ca8d5cb787c42495b3a58b46929d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Spr=C3=A5ng?= Date: Tue, 30 Jul 2019 22:36:02 +0200 Subject: [PATCH] Fix SendSideBweWithOverhead using new pacer code path. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This field trial was read in RTPSender, and the altered packet size passed along to the pacer. Now, the pacer packet queue looks directly at the packet instance, so it needs to be aware of the experiment flag in order to make the right decision. Bug: webrtc:10633, b/138582168 Change-Id: If1148f39c463e11ad49a659913465f131cf9b526 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/147270 Commit-Queue: Erik Språng Reviewed-by: Sebastian Jansson Cr-Commit-Position: refs/heads/master@{#28714} --- modules/pacing/paced_sender.cc | 2 +- modules/pacing/round_robin_packet_queue.cc | 19 ++++++++++++++++--- modules/pacing/round_robin_packet_queue.h | 6 +++++- 3 files changed, 22 insertions(+), 5 deletions(-) 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