Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit ccbc216

Browse files
Erik SprångCommit Bot
authored andcommitted
Avoids potential rounding of -inf time delta in TaskQueuePacedSender.
This rounding triggers a dcheck that crashes debug builds. Furtunately, in release mode this does not matter as the resulting value is anyway capped to 0. Unfortunately, it is almost impossible to write a test for this even with simulated time as the conditions needed to trigger this condition includes thread scheduling being slightly off in such a way that an unscheduled process call preempts a scheduled one at a time when sending a sufficiently large padding packet becomes possible - and right after starting a new probe cluster. We should consider updating this class to make unit testing easier. Bug: webrtc:10809 Change-Id: I533e6e716bddc106d11e82a9e3edb4e0035fd21c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192786 Reviewed-by: Per Kjellander <[email protected]> Commit-Queue: Erik Språng <[email protected]> Cr-Commit-Position: refs/heads/master@{#32589}
1 parent 06bbeb3 commit ccbc216

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

modules/pacing/task_queue_paced_sender.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,13 @@ void TaskQueuePacedSender::MaybeProcessPackets(
224224
// If we're probing and there isn't already a wakeup scheduled for the next
225225
// process time, always post a task and just round sleep time down to
226226
// nearest millisecond.
227-
time_to_next_process =
228-
std::max(TimeDelta::Zero(),
229-
(next_process_time - now).RoundDownTo(TimeDelta::Millis(1)));
227+
if (next_process_time.IsMinusInfinity()) {
228+
time_to_next_process = TimeDelta::Zero();
229+
} else {
230+
time_to_next_process =
231+
std::max(TimeDelta::Zero(),
232+
(next_process_time - now).RoundDownTo(TimeDelta::Millis(1)));
233+
}
230234
} else if (next_process_time_.IsMinusInfinity() ||
231235
next_process_time <= next_process_time_ - hold_back_window_) {
232236
// Schedule a new task since there is none currently scheduled

0 commit comments

Comments
 (0)