In RtcpTransceiver use TimeDelta instead of raw int to represent time

Bug: webrtc:8239, webrtc:13757
Change-Id: Idda3fe5761665b4b3fedaf2dd1a28bb0119ae1f1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252287
Reviewed-by: Emil Lundmark <lndmrk@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36094}
This commit is contained in:
Danil Chapovalov
2022-02-23 20:15:20 +01:00
committed by WebRTC LUCI CQ
parent 9af4aa7cf4
commit c2b1bad4c8
5 changed files with 26 additions and 26 deletions

View File

@ -100,7 +100,7 @@ RtcpTransceiverImpl::RtcpTransceiverImpl(const RtcpTransceiverConfig& config)
: config_(config), ready_to_send_(config.initial_ready_to_send) {
RTC_CHECK(config_.Validate());
if (ready_to_send_ && config_.schedule_periodic_compound_packets) {
SchedulePeriodicCompoundPackets(config_.initial_report_delay_ms);
SchedulePeriodicCompoundPackets(config_.initial_report_delay);
}
}
@ -159,7 +159,7 @@ void RtcpTransceiverImpl::SetReadyToSend(bool ready) {
periodic_task_handle_.Stop();
if (!ready_to_send_ && ready) // Restart periodic sending.
SchedulePeriodicCompoundPackets(config_.report_period_ms / 2);
SchedulePeriodicCompoundPackets(config_.report_period / 2);
}
ready_to_send_ = ready;
}
@ -470,16 +470,16 @@ void RtcpTransceiverImpl::ReschedulePeriodicCompoundPackets() {
return;
periodic_task_handle_.Stop();
RTC_DCHECK(ready_to_send_);
SchedulePeriodicCompoundPackets(config_.report_period_ms);
SchedulePeriodicCompoundPackets(config_.report_period);
}
void RtcpTransceiverImpl::SchedulePeriodicCompoundPackets(int64_t delay_ms) {
periodic_task_handle_ = RepeatingTaskHandle::DelayedStart(
config_.task_queue, TimeDelta::Millis(delay_ms), [this] {
void RtcpTransceiverImpl::SchedulePeriodicCompoundPackets(TimeDelta delay) {
periodic_task_handle_ =
RepeatingTaskHandle::DelayedStart(config_.task_queue, delay, [this] {
RTC_DCHECK(config_.schedule_periodic_compound_packets);
RTC_DCHECK(ready_to_send_);
SendPeriodicCompoundPacket();
return TimeDelta::Millis(config_.report_period_ms);
return config_.report_period;
});
}