Revert "Prepares PacingController for simplified packet queue."

This reverts commit acdc22d7845c5dde7c23366110e54e5d26127c85.

Reason for revert: Field trials are not enabled in the same way, will reland after that is fixed.

Original change's description:
> Prepares PacingController for simplified packet queue.
> 
> This CL removes references to RoundRobinPacketQueue::QueuedPacket,
> other than the method to release an RtpPacketToSend. It also moves
> both the BeginPop() and FinalizePop() to within a single helper
> method.
> 
> A follow-up cleanup of the packet queue will stop exposing the
> QueuedPacket struct and replaces the the pop-methods with a single
> new one that just returns an RtpPacketToSend.
> 
> Bug: webrtc:10809
> Change-Id: I5208a93e12e6b56714d483cc12d2a37225ea8e5e
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/159889
> Commit-Queue: Erik Språng <sprang@webrtc.org>
> Reviewed-by: Philip Eliasson <philipel@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#29820}

TBR=sprang@webrtc.org,philipel@webrtc.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: webrtc:10809
Change-Id: I02fccbfbba6b9670b0ce2008e067df3aa9d3c5f2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160010
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29836}
This commit is contained in:
Erik Språng
2019-11-19 15:51:45 +00:00
parent 0660ceef0e
commit fa7a8ca21c
2 changed files with 16 additions and 32 deletions

View File

@ -99,8 +99,6 @@ PacingController::PacingController(Clock* clock,
pace_audio_(!IsDisabled(*field_trials_, "WebRTC-Pacer-BlockAudio")),
small_first_probe_packet_(
IsEnabled(*field_trials_, "WebRTC-Pacer-SmallFirstProbePacket")),
send_side_bwe_with_overhead_(
IsEnabled(*field_trials_, "WebRTC-SendSideBwe-WithOverhead")),
min_packet_limit_(kDefaultMinPacketLimit),
last_timestamp_(clock_->CurrentTime()),
paused_(false),
@ -465,10 +463,8 @@ void PacingController::ProcessPackets() {
// Fetch the next packet, so long as queue is not empty or budget is not
// exhausted.
std::unique_ptr<RtpPacketToSend> rtp_packet =
GetPendingPacket(pacing_info, target_send_time, now);
if (rtp_packet == nullptr) {
auto* packet = GetPendingPacket(pacing_info, target_send_time, now);
if (packet == nullptr) {
// No packet available to send, check if we should send padding.
DataSize padding_to_add = PaddingToAdd(recommended_probe_size, data_sent);
if (padding_to_add > DataSize::Zero()) {
@ -489,19 +485,14 @@ void PacingController::ProcessPackets() {
break;
}
std::unique_ptr<RtpPacketToSend> rtp_packet = packet->ReleasePacket();
RTC_DCHECK(rtp_packet);
RTC_DCHECK(rtp_packet->packet_type().has_value());
const RtpPacketToSend::Type packet_type = *rtp_packet->packet_type();
const DataSize packet_size = DataSize::bytes(
send_side_bwe_with_overhead_
? rtp_packet->size()
: rtp_packet->payload_size() + rtp_packet->padding_size());
packet_sender_->SendRtpPacket(std::move(rtp_packet), pacing_info);
data_sent += packet_size;
// Send done, update send/process time to the target send time.
OnPacketSent(packet_type, packet_size, target_send_time);
data_sent += packet->size();
// Send succeeded, remove it from the queue and update send/process time to
// the target send time.
OnPacketSent(packet, target_send_time);
if (recommended_probe_size && data_sent > *recommended_probe_size)
break;
@ -560,7 +551,7 @@ DataSize PacingController::PaddingToAdd(
return DataSize::Zero();
}
std::unique_ptr<RtpPacketToSend> PacingController::GetPendingPacket(
RoundRobinPacketQueue::QueuedPacket* PacingController::GetPendingPacket(
const PacedPacketInfo& pacing_info,
Timestamp target_send_time,
Timestamp now) {
@ -601,28 +592,23 @@ std::unique_ptr<RtpPacketToSend> PacingController::GetPendingPacket(
}
}
auto* queued_packet = packet_queue_.BeginPop();
std::unique_ptr<RtpPacketToSend> rtp_packet;
if (queued_packet != nullptr) {
rtp_packet = queued_packet->ReleasePacket();
packet_queue_.FinalizePop();
}
return rtp_packet;
return packet_queue_.BeginPop();
}
void PacingController::OnPacketSent(RtpPacketToSend::Type packet_type,
DataSize packet_size,
void PacingController::OnPacketSent(RoundRobinPacketQueue::QueuedPacket* packet,
Timestamp send_time) {
if (!first_sent_packet_time_) {
first_sent_packet_time_ = send_time;
}
bool audio_packet = packet_type == RtpPacketToSend::Type::kAudio;
bool audio_packet = packet->type() == RtpPacketToSend::Type::kAudio;
if (!audio_packet || account_for_audio_) {
// Update media bytes sent.
UpdateBudgetWithSentData(packet_size);
UpdateBudgetWithSentData(packet->size());
}
last_send_time_ = send_time;
last_process_time_ = send_time;
// Send succeeded, remove it from the queue.
packet_queue_.FinalizePop();
}
void PacingController::OnPaddingSent(DataSize data_sent) {