From 3284b61a6c6f3b6607cd3a779114c1bdaa5d37a4 Mon Sep 17 00:00:00 2001 From: Christoffer Rodbro Date: Tue, 23 Oct 2018 16:51:51 +0200 Subject: [PATCH] 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 Commit-Queue: Christoffer Rodbro Cr-Commit-Position: refs/heads/master@{#25362} --- call/fake_network_pipe.cc | 19 +++---------------- call/fake_network_pipe.h | 3 --- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/call/fake_network_pipe.cc b/call/fake_network_pipe.cc index e702c1b6f5..df97046ad6 100644 --- a/call/fake_network_pipe.cc +++ b/call/fake_network_pipe.cc @@ -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(); } diff --git a/call/fake_network_pipe.h b/call/fake_network_pipe.h index f85e82efc5..372c7c5ddf 100644 --- a/call/fake_network_pipe.h +++ b/call/fake_network_pipe.h @@ -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);