Cleanup ReportBlockData accessors
Remove deprecated accessors returning time as raw int
Add setters for all fields to simplify usage of this class in tests
Remove unused min/max RTT fields
Bug: webrtc:13757
Change-Id: Ia8966975c15b9a930f54b4db0fc75f7002dcffe1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/304461
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Emil Lundmark <lndmrk@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40013}
diff --git a/modules/rtp_rtcp/include/report_block_data.cc b/modules/rtp_rtcp/include/report_block_data.cc
index 2998cc6..0d4fed0 100644
--- a/modules/rtp_rtcp/include/report_block_data.cc
+++ b/modules/rtp_rtcp/include/report_block_data.cc
@@ -34,10 +34,6 @@
}
void ReportBlockData::AddRoundTripTimeSample(TimeDelta rtt) {
- if (rtt > max_rtt_)
- max_rtt_ = rtt;
- if (num_rtts_ == 0 || rtt < min_rtt_)
- min_rtt_ = rtt;
last_rtt_ = rtt;
sum_rtt_ += rtt;
++num_rtts_;
diff --git a/modules/rtp_rtcp/include/report_block_data.h b/modules/rtp_rtcp/include/report_block_data.h
index 3e539ab..9987fc46 100644
--- a/modules/rtp_rtcp/include/report_block_data.h
+++ b/modules/rtp_rtcp/include/report_block_data.h
@@ -69,14 +69,6 @@
// Jitter converted to common time units.
TimeDelta jitter(int rtp_clock_rate_hz) const;
- [[deprecated]] int64_t report_block_timestamp_utc_us() const {
- return report_block_timestamp_utc_.us();
- }
- [[deprecated]] int64_t last_rtt_ms() const { return last_rtt_.ms(); }
- [[deprecated]] int64_t min_rtt_ms() const { return min_rtt_.ms(); }
- [[deprecated]] int64_t max_rtt_ms() const { return max_rtt_.ms(); }
- [[deprecated]] int64_t sum_rtt_ms() const { return sum_rtt_.ms(); }
-
// Time in utc epoch (Jan 1st, 1970) the report block was received.
Timestamp report_block_timestamp_utc() const {
return report_block_timestamp_utc_;
@@ -85,16 +77,21 @@
// Round Trip Time measurments for given (sender_ssrc, source_ssrc) pair.
// Min, max, sum, number of measurements are since beginning of the call.
TimeDelta last_rtt() const { return last_rtt_; }
- TimeDelta min_rtt() const { return min_rtt_; }
- TimeDelta max_rtt() const { return max_rtt_; }
TimeDelta sum_rtts() const { return sum_rtt_; }
size_t num_rtts() const { return num_rtts_; }
bool has_rtt() const { return num_rtts_ != 0; }
+ void set_sender_ssrc(uint32_t ssrc) { sender_ssrc_ = ssrc; }
void set_source_ssrc(uint32_t ssrc) { source_ssrc_ = ssrc; }
void set_fraction_lost_raw(uint8_t lost) { fraction_lost_raw_ = lost; }
void set_cumulative_lost(int lost) { cumulative_lost_ = lost; }
+ void set_extended_highest_sequence_number(uint32_t sn) {
+ extended_highest_sequence_number_ = sn;
+ }
void set_jitter(uint32_t jitter) { jitter_ = jitter; }
+ void set_report_block_timestamp_utc(Timestamp arrival_time) {
+ report_block_timestamp_utc_ = arrival_time;
+ }
void SetReportBlock(uint32_t sender_ssrc,
const rtcp::ReportBlock& report_block,
@@ -110,8 +107,6 @@
uint32_t jitter_ = 0;
Timestamp report_block_timestamp_utc_ = Timestamp::Zero();
TimeDelta last_rtt_ = TimeDelta::Zero();
- TimeDelta min_rtt_ = TimeDelta::Zero();
- TimeDelta max_rtt_ = TimeDelta::Zero();
TimeDelta sum_rtt_ = TimeDelta::Zero();
size_t num_rtts_ = 0;
};
diff --git a/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
index b1a5667..9cfc881 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
@@ -1618,8 +1618,6 @@
.WillOnce([&](ReportBlockData report_block_data) {
EXPECT_EQ(kReceiverMainSsrc, report_block_data.source_ssrc());
EXPECT_EQ(1u, report_block_data.num_rtts());
- EXPECT_EQ(kRtt, report_block_data.min_rtt());
- EXPECT_EQ(kRtt, report_block_data.max_rtt());
EXPECT_EQ(kRtt, report_block_data.sum_rtts());
EXPECT_EQ(kRtt, report_block_data.last_rtt());
});
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index d87763a..913885e 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -113,15 +113,15 @@
// `process_rtt` first.
if (process_rtt && rtt_stats_ != nullptr &&
rtcp_receiver_.LastReceivedReportBlockMs() > last_rtt_process_time_) {
- int64_t max_rtt_ms = 0;
+ TimeDelta max_rtt = TimeDelta::Zero();
for (const auto& block : rtcp_receiver_.GetLatestReportBlockData()) {
- if (block.last_rtt_ms() > max_rtt_ms) {
- max_rtt_ms = block.last_rtt_ms();
+ if (block.last_rtt() > max_rtt) {
+ max_rtt = block.last_rtt();
}
}
// Report the rtt.
- if (max_rtt_ms > 0) {
- rtt_stats_->OnRttUpdate(max_rtt_ms);
+ if (max_rtt > TimeDelta::Zero()) {
+ rtt_stats_->OnRttUpdate(max_rtt.ms());
}
}