Fix for packet loss tracking in network emulation.

Fake_network_pipe currently only counts losses due to buffer overflow.
Fix by counting all packets marked as lost.

Bug: webrtc:9904
Change-Id: I070538b289d925c650d8abca1644ba015227c2a7
Reviewed-on: https://webrtc-review.googlesource.com/c/107646
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Commit-Queue: Christoffer Rodbro <crodbro@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25362}
This commit is contained in:
Christoffer Rodbro 2018-10-23 16:51:51 +02:00 committed by Commit Bot
parent 262047055d
commit 3284b61a6c
2 changed files with 3 additions and 19 deletions

View File

@ -250,9 +250,11 @@ void FakeNetworkPipe::Process() {
// arrived, due to NetworkProcess being called too late. For stats, use
// the time it should have been on the link.
total_packet_delay_us_ += added_delay_us;
++sent_packets_;
} else {
++dropped_packets_;
}
}
sent_packets_ += packets_to_deliver.size();
}
rtc::CritScope crit(&config_lock_);
@ -316,21 +318,6 @@ void FakeNetworkPipe::ResetStats() {
total_packet_delay_us_ = 0;
}
void FakeNetworkPipe::AddToPacketDropCount() {
rtc::CritScope crit(&process_lock_);
++dropped_packets_;
}
void FakeNetworkPipe::AddToPacketSentCount(int count) {
rtc::CritScope crit(&process_lock_);
sent_packets_ += count;
}
void FakeNetworkPipe::AddToTotalDelay(int delay_us) {
rtc::CritScope crit(&process_lock_);
total_packet_delay_us_ += delay_us;
}
int64_t FakeNetworkPipe::GetTimeInMicroseconds() const {
return clock_->TimeInMicroseconds();
}

View File

@ -150,9 +150,6 @@ class FakeNetworkPipe : public webrtc::SimulatedPacketReceiverInterface,
protected:
void DeliverPacketWithLock(NetworkPacket* packet);
void AddToPacketDropCount();
void AddToPacketSentCount(int count);
void AddToTotalDelay(int delay_us);
int64_t GetTimeInMicroseconds() const;
bool ShouldProcess(int64_t time_now_us) const;
void SetTimeToNextProcess(int64_t skip_us);