Delete redundant member StreamDataCounters::last_packet_received_time

StreamDataCounters is used both for send-side and receive side stats,
but last_packet_received_time is only used by receive statistician where
it duplicates another member

Bug: webrtc:13757
Change-Id: Iae6a65aba497e577ee3255e40623362e8c4c8a72
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306183
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40119}
This commit is contained in:
Danil Chapovalov 2023-05-22 18:30:28 +02:00 committed by WebRTC LUCI CQ
parent 0328190ab3
commit 98f47a300b
3 changed files with 8 additions and 13 deletions

View File

@ -363,11 +363,7 @@ struct StreamDataCounters {
fec.payload_bytes;
}
int64_t first_packet_time_ms; // Time when first packet is sent/received.
// The timestamp at which the last packet was received, i.e. the time of the
// local clock when it was received - not the RTP timestamp of that packet.
// https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-lastpacketreceivedtimestamp
absl::optional<int64_t> last_packet_received_timestamp_ms;
int64_t first_packet_time_ms; // Time when first packet is sent/received.
RtpPacketCounter transmitted; // Number of transmitted packets/bytes.
RtpPacketCounter retransmitted; // Number of retransmitted packets/bytes.
RtpPacketCounter fec; // Number of redundancy packets/bytes.

View File

@ -113,7 +113,6 @@ void StreamStatisticianImpl::UpdateCounters(const RtpPacketReceived& packet) {
int64_t now_ms = clock_->TimeInMilliseconds();
incoming_bitrate_.Update(packet.size(), now_ms);
receive_counters_.last_packet_received_timestamp_ms = now_ms;
receive_counters_.transmitted.AddPacket(packet);
--cumulative_loss_;
@ -221,10 +220,9 @@ RtpReceiveStats StreamStatisticianImpl::GetStats() const {
stats.interarrival_jitter =
webrtc::TimeDelta::Seconds(stats.jitter) / last_payload_type_frequency_;
}
if (receive_counters_.last_packet_received_timestamp_ms.has_value()) {
if (last_receive_time_ms_ > 0) {
stats.last_packet_received_timestamp_ms =
*receive_counters_.last_packet_received_timestamp_ms +
delta_internal_unix_epoch_ms_;
last_receive_time_ms_ + delta_internal_unix_epoch_ms_;
}
stats.packet_counter = receive_counters_.transmitted;
return stats;

View File

@ -590,16 +590,17 @@ TEST_P(ReceiveStatisticsTest, StreamDataCounters) {
TEST_P(ReceiveStatisticsTest, LastPacketReceivedTimestamp) {
clock_.AdvanceTimeMilliseconds(42);
packet1_.SetSequenceNumber(100);
receive_statistics_->OnRtpPacket(packet1_);
StreamDataCounters counters = receive_statistics_->GetStatistician(kSsrc1)
->GetReceiveStreamDataCounters();
RtpReceiveStats counters =
receive_statistics_->GetStatistician(kSsrc1)->GetStats();
EXPECT_EQ(42, counters.last_packet_received_timestamp_ms);
clock_.AdvanceTimeMilliseconds(3);
packet1_.SetSequenceNumber(101);
receive_statistics_->OnRtpPacket(packet1_);
counters = receive_statistics_->GetStatistician(kSsrc1)
->GetReceiveStreamDataCounters();
counters = receive_statistics_->GetStatistician(kSsrc1)->GetStats();
EXPECT_EQ(45, counters.last_packet_received_timestamp_ms);
}