Make it possible to enable/disable receive-side RTT with a setter.

This will allow us to enable receive-side RTT without having to recreate all AudioReceiveStream objects.

Bug: webrtc:12951
Change-Id: I1227297ec4ebeea9ba15fe2ed904349829b2e669
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225262
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34464}
This commit is contained in:
Ivo Creusen
2021-07-13 12:53:22 +00:00
committed by WebRTC LUCI CQ
parent 51969310ef
commit 8c40d510c8
11 changed files with 125 additions and 12 deletions

View File

@ -103,14 +103,11 @@ ModuleRtpRtcpImpl2::ModuleRtpRtcpImpl2(const Configuration& configuration)
// webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize.
const size_t kTcpOverIpv4HeaderSize = 40;
SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize);
if (rtt_stats_) {
rtt_update_task_ = RepeatingTaskHandle::DelayedStart(
worker_queue_, kRttUpdateInterval, [this]() {
PeriodicUpdate();
return kRttUpdateInterval;
});
}
rtt_update_task_ = RepeatingTaskHandle::DelayedStart(
worker_queue_, kRttUpdateInterval, [this]() {
PeriodicUpdate();
return kRttUpdateInterval;
});
}
ModuleRtpRtcpImpl2::~ModuleRtpRtcpImpl2() {
@ -204,6 +201,11 @@ RtpState ModuleRtpRtcpImpl2::GetRtxState() const {
return rtp_sender_->packet_generator.GetRtxRtpState();
}
void ModuleRtpRtcpImpl2::SetNonSenderRttMeasurement(bool enabled) {
rtcp_sender_.SetNonSenderRttMeasurement(enabled);
rtcp_receiver_.SetNonSenderRttMeasurement(enabled);
}
uint32_t ModuleRtpRtcpImpl2::local_media_ssrc() const {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
RTC_DCHECK_EQ(rtcp_receiver_.local_media_ssrc(), rtcp_sender_.SSRC());
@ -739,7 +741,9 @@ void ModuleRtpRtcpImpl2::PeriodicUpdate() {
absl::optional<TimeDelta> rtt =
rtcp_receiver_.OnPeriodicRttUpdate(check_since, rtcp_sender_.Sending());
if (rtt) {
rtt_stats_->OnRttUpdate(rtt->ms());
if (rtt_stats_) {
rtt_stats_->OnRttUpdate(rtt->ms());
}
set_rtt_ms(rtt->ms());
}
}