Fix issue with SchedulableNetworkBehavior::UpdateConfigAndReschedule returning negative delay
If the task queue is blocked, there is a risk that delay becomes negative. Therefore, use max of calculated time to next schedule and 0. Bug: webrtc:42224804 Change-Id: Ibae9000192d5042cf62b46d93e8364b58dae0d82 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/354880 Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Björn Terelius <terelius@webrtc.org> Commit-Queue: Per Kjellander <perkj@webrtc.org> Auto-Submit: Per Kjellander <perkj@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42501}
This commit is contained in:
parent
6948d84f63
commit
feea82fad5
@ -117,9 +117,10 @@ TimeDelta SchedulableNetworkBehavior::UpdateConfigAndReschedule() {
|
||||
webrtc::TimeDelta time_since_first_sent_packet =
|
||||
reschedule_time - first_send_time_;
|
||||
if (next_schedule_index_ != 0) {
|
||||
delay = webrtc::TimeDelta::Millis(schedule_.item()[next_schedule_index_]
|
||||
.time_since_first_sent_packet_ms()) -
|
||||
(time_since_first_sent_packet - wrap_time_delta_);
|
||||
delay = std::max(TimeDelta::Millis(schedule_.item()[next_schedule_index_]
|
||||
.time_since_first_sent_packet_ms()) -
|
||||
(time_since_first_sent_packet - wrap_time_delta_),
|
||||
TimeDelta::Zero());
|
||||
} else if (!schedule_.has_repeat_schedule_after_last_ms()) {
|
||||
// No more schedule items.
|
||||
schedule_task_.Stop();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user