Removes AddAndRemoveOld from SendTimeHistory

Bug: webrtc:9883
Change-Id: Id9ae4b2485ba5ff201e77771774cfc83ccbda0d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/142220
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28295}
diff --git a/modules/congestion_controller/rtp/send_time_history.cc b/modules/congestion_controller/rtp/send_time_history.cc
index 9101f4a..2d0356b 100644
--- a/modules/congestion_controller/rtp/send_time_history.cc
+++ b/modules/congestion_controller/rtp/send_time_history.cc
@@ -44,12 +44,6 @@
   }
 }
 
-void SendTimeHistory::AddAndRemoveOld(const PacketFeedback& packet,
-                                      int64_t at_time_ms) {
-  RemoveOld(at_time_ms);
-  AddNewPacket(packet);
-}
-
 void SendTimeHistory::AddUntracked(size_t packet_size, int64_t send_time_ms) {
   if (send_time_ms < last_send_time_ms_) {
     RTC_LOG(LS_WARNING) << "ignoring untracked data for out of order packet.";
diff --git a/modules/congestion_controller/rtp/send_time_history.h b/modules/congestion_controller/rtp/send_time_history.h
index c3004c1..abdbab7 100644
--- a/modules/congestion_controller/rtp/send_time_history.h
+++ b/modules/congestion_controller/rtp/send_time_history.h
@@ -31,7 +31,6 @@
   // Cleanup old entries, then add new packet info with provided parameters.
   void RemoveOld(int64_t at_time_ms);
   void AddNewPacket(PacketFeedback packet);
-  void AddAndRemoveOld(const PacketFeedback& packet, int64_t at_time_ms);
 
   void AddUntracked(size_t packet_size, int64_t send_time_ms);
 
diff --git a/modules/congestion_controller/rtp/send_time_history_unittest.cc b/modules/congestion_controller/rtp/send_time_history_unittest.cc
index d872f89..ecd5366 100644
--- a/modules/congestion_controller/rtp/send_time_history_unittest.cc
+++ b/modules/congestion_controller/rtp/send_time_history_unittest.cc
@@ -39,7 +39,8 @@
                              const PacedPacketInfo& pacing_info) {
     PacketFeedback packet(clock_.TimeInMilliseconds(), sequence_number, length,
                           0, 0, pacing_info);
-    history_.AddAndRemoveOld(packet, clock_.TimeInMilliseconds());
+    history_.RemoveOld(clock_.TimeInMilliseconds());
+    history_.AddNewPacket(packet);
     history_.OnSentPacket(sequence_number, send_time_ms);
   }
 
@@ -53,7 +54,8 @@
   int64_t now_ms = clock_.TimeInMilliseconds();
   for (int i = 1; i < 5; ++i) {
     PacketFeedback packet(now_ms, sequence_number, 1000, i, i - 1, kPacingInfo);
-    history_.AddAndRemoveOld(packet, clock_.TimeInMilliseconds());
+    history_.RemoveOld(clock_.TimeInMilliseconds());
+    history_.AddNewPacket(packet);
     history_.OnSentPacket(sequence_number, now_ms);
     PacketFeedback restored(now_ms, sequence_number);
     EXPECT_TRUE(history_.GetFeedback(&restored, sequence_number++));
@@ -138,7 +140,8 @@
     PacketFeedback packet = sent_packets[i];
     packet.arrival_time_ms = PacketFeedback::kNotReceived;
     packet.send_time_ms = PacketFeedback::kNoSendTime;
-    history_.AddAndRemoveOld(packet, clock_.TimeInMilliseconds());
+    history_.RemoveOld(clock_.TimeInMilliseconds());
+    history_.AddNewPacket(packet);
   }
   for (size_t i = 0; i < num_items; ++i)
     history_.OnSentPacket(sent_packets[i].sequence_number,