Prevents probing while paused.

The pacing controller allowed sending bitrate probes, despite it being
paused. This CL adresses that, and makes sure the task-queue based mode
also properly repsects pausing.

Bug: webrtc:10809
Change-Id: I79643c9a24666110d7583fce3ed1bfd6865e9e10
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/162520
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30109}
This commit is contained in:
Erik Språng
2019-12-17 17:49:49 +01:00
committed by Commit Bot
parent 768c5f438c
commit ae10029bff
2 changed files with 34 additions and 4 deletions

View File

@ -308,6 +308,10 @@ bool PacingController::ShouldSendKeepalive(Timestamp now) const {
Timestamp PacingController::NextSendTime() const {
Timestamp now = CurrentTime();
if (paused_) {
return last_send_time_ + kPausedProcessInterval;
}
// If probing is active, that always takes priority.
if (prober_.IsProbing()) {
Timestamp probe_time = prober_.NextProbeTime(now);
@ -318,10 +322,7 @@ Timestamp PacingController::NextSendTime() const {
}
if (mode_ == ProcessMode::kPeriodic) {
// In periodc non-probing mode, we just have a fixed interval.
if (paused_) {
return last_send_time_ + kPausedProcessInterval;
}
// In periodic non-probing mode, we just have a fixed interval.
return last_process_time_ + min_packet_limit_;
}

View File

@ -1737,6 +1737,35 @@ TEST_P(PacingControllerTest, TaskLate) {
pacer_->ProcessPackets();
}
TEST_P(PacingControllerTest, NoProbingWhilePaused) {
uint32_t ssrc = 12345;
uint16_t sequence_number = 1234;
pacer_->SetProbingEnabled(true);
// Send at least one packet so probing can initate.
SendAndExpectPacket(RtpPacketToSend::Type::kVideo, ssrc, sequence_number,
clock_.TimeInMilliseconds(), 250);
while (pacer_->QueueSizePackets() > 0) {
AdvanceTimeAndProcess();
}
// Trigger probing.
pacer_->CreateProbeCluster(DataRate::kbps(10000), // 10 Mbps.
/*cluster_id=*/3);
// Time to next send time should be small.
EXPECT_LT(pacer_->NextSendTime() - clock_.CurrentTime(),
PacingController::kPausedProcessInterval);
// Pause pacer, time to next send time should now be the pause process
// interval.
pacer_->Pause();
EXPECT_EQ(pacer_->NextSendTime() - clock_.CurrentTime(),
PacingController::kPausedProcessInterval);
}
INSTANTIATE_TEST_SUITE_P(
WithAndWithoutIntervalBudget,
PacingControllerTest,