Avoid bouncing first probe packet via pacer queue.
This avoids potentially creating structures in the queue, and removes usage of a special priority class enabling us to move priority handling in a follow-up. Bug: webrtc:11340 Change-Id: I2286ef6eac62e1d6dd89f6eb6035b23f27543d8a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259960 Reviewed-by: Emil Lundmark <lndmrk@webrtc.org> Commit-Queue: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36641}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
88b8dec17b
commit
e65d05da25
@ -471,21 +471,6 @@ void PacingController::ProcessPackets() {
|
|||||||
if (pacing_info.probe_cluster_id != PacedPacketInfo::kNotAProbe) {
|
if (pacing_info.probe_cluster_id != PacedPacketInfo::kNotAProbe) {
|
||||||
recommended_probe_size = prober_.RecommendedMinProbeSize();
|
recommended_probe_size = prober_.RecommendedMinProbeSize();
|
||||||
RTC_DCHECK_GT(recommended_probe_size, DataSize::Zero());
|
RTC_DCHECK_GT(recommended_probe_size, DataSize::Zero());
|
||||||
|
|
||||||
// If first packet in probe, insert a small padding packet so we have a
|
|
||||||
// more reliable start window for the rate estimation.
|
|
||||||
if (pacing_info.probe_cluster_bytes_sent == 0) {
|
|
||||||
auto padding = packet_sender_->GeneratePadding(DataSize::Bytes(1));
|
|
||||||
// If no RTP modules sending media are registered, we may not get a
|
|
||||||
// padding packet back.
|
|
||||||
if (!padding.empty()) {
|
|
||||||
// Insert with high priority so larger media packets don't preempt it.
|
|
||||||
EnqueuePacketInternal(std::move(padding[0]), kFirstPriority);
|
|
||||||
// We should never get more than one padding packets with a requested
|
|
||||||
// size of 1 byte.
|
|
||||||
RTC_DCHECK_EQ(padding.size(), 1u);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// No valid probe cluster returned, probe might have timed out.
|
// No valid probe cluster returned, probe might have timed out.
|
||||||
is_probing = false;
|
is_probing = false;
|
||||||
@ -546,11 +531,14 @@ void PacingController::ProcessPackets() {
|
|||||||
// Send done, update send time.
|
// Send done, update send time.
|
||||||
OnPacketSent(packet_type, packet_size, now);
|
OnPacketSent(packet_type, packet_size, now);
|
||||||
|
|
||||||
|
if (is_probing) {
|
||||||
|
pacing_info.probe_cluster_bytes_sent += packet_size.bytes();
|
||||||
// If we are currently probing, we need to stop the send loop when we
|
// If we are currently probing, we need to stop the send loop when we
|
||||||
// have reached the send target.
|
// have reached the send target.
|
||||||
if (is_probing && data_sent >= recommended_probe_size) {
|
if (data_sent >= recommended_probe_size) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update target send time in case that are more packets that we are late
|
// Update target send time in case that are more packets that we are late
|
||||||
// in processing.
|
// in processing.
|
||||||
@ -627,6 +615,22 @@ std::unique_ptr<RtpPacketToSend> PacingController::GetPendingPacket(
|
|||||||
const PacedPacketInfo& pacing_info,
|
const PacedPacketInfo& pacing_info,
|
||||||
Timestamp target_send_time,
|
Timestamp target_send_time,
|
||||||
Timestamp now) {
|
Timestamp now) {
|
||||||
|
const bool is_probe =
|
||||||
|
pacing_info.probe_cluster_id != PacedPacketInfo::kNotAProbe;
|
||||||
|
// If first packet in probe, insert a small padding packet so we have a
|
||||||
|
// more reliable start window for the rate estimation.
|
||||||
|
if (is_probe && pacing_info.probe_cluster_bytes_sent == 0) {
|
||||||
|
auto padding = packet_sender_->GeneratePadding(DataSize::Bytes(1));
|
||||||
|
// If no RTP modules sending media are registered, we may not get a
|
||||||
|
// padding packet back.
|
||||||
|
if (!padding.empty()) {
|
||||||
|
// We should never get more than one padding packets with a requested
|
||||||
|
// size of 1 byte.
|
||||||
|
RTC_DCHECK_EQ(padding.size(), 1u);
|
||||||
|
return std::move(padding[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (packet_queue_.Empty()) {
|
if (packet_queue_.Empty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -636,7 +640,6 @@ std::unique_ptr<RtpPacketToSend> PacingController::GetPendingPacket(
|
|||||||
// Unpaced audio packets and probes are exempted from send checks.
|
// Unpaced audio packets and probes are exempted from send checks.
|
||||||
bool unpaced_audio_packet =
|
bool unpaced_audio_packet =
|
||||||
!pace_audio_ && packet_queue_.LeadingAudioPacketEnqueueTime().has_value();
|
!pace_audio_ && packet_queue_.LeadingAudioPacketEnqueueTime().has_value();
|
||||||
bool is_probe = pacing_info.probe_cluster_id != PacedPacketInfo::kNotAProbe;
|
|
||||||
if (!unpaced_audio_packet && !is_probe) {
|
if (!unpaced_audio_packet && !is_probe) {
|
||||||
if (congested_) {
|
if (congested_) {
|
||||||
// Don't send anything if congested.
|
// Don't send anything if congested.
|
||||||
|
Reference in New Issue
Block a user