Remove smart flushing experiment.

It did not result in big quality improvements.

Bug: webrtc:12201
Change-Id: I9728469a388ee179d6069af8521bfc5571870bd7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325533
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41087}
diff --git a/modules/audio_coding/neteq/mock/mock_packet_buffer.h b/modules/audio_coding/neteq/mock/mock_packet_buffer.h
index 48357ea..575fe84 100644
--- a/modules/audio_coding/neteq/mock/mock_packet_buffer.h
+++ b/modules/audio_coding/neteq/mock/mock_packet_buffer.h
@@ -23,22 +23,10 @@
   ~MockPacketBuffer() override { Die(); }
   MOCK_METHOD(void, Die, ());
   MOCK_METHOD(void, Flush, (StatisticsCalculator * stats), (override));
-  MOCK_METHOD(void,
-              PartialFlush,
-              (int target_level_ms,
-               size_t sample_rate,
-               size_t last_decoded_length,
-               StatisticsCalculator* stats),
-              (override));
   MOCK_METHOD(bool, Empty, (), (const, override));
   MOCK_METHOD(int,
               InsertPacket,
-              (Packet && packet,
-               StatisticsCalculator* stats,
-               size_t last_decoded_length,
-               size_t sample_rate,
-               int target_level_ms,
-               const DecoderDatabase& decoder_database),
+              (Packet && packet, StatisticsCalculator* stats),
               (override));
   MOCK_METHOD(int,
               InsertPacketList,
@@ -46,10 +34,7 @@
                const DecoderDatabase& decoder_database,
                absl::optional<uint8_t>* current_rtp_payload_type,
                absl::optional<uint8_t>* current_cng_rtp_payload_type,
-               StatisticsCalculator* stats,
-               size_t last_decoded_length,
-               size_t sample_rate,
-               int target_level_ms),
+               StatisticsCalculator* stats),
               (override));
   MOCK_METHOD(int,
               NextTimestamp,
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index 52e8cba..cb0827f 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -682,23 +682,15 @@
   }
 
   // Insert packets in buffer.
-  const int target_level_ms = controller_->TargetLevelMs();
   const int ret = packet_buffer_->InsertPacketList(
       &parsed_packet_list, *decoder_database_, &current_rtp_payload_type_,
-      &current_cng_rtp_payload_type_, stats_.get(), decoder_frame_length_,
-      last_output_sample_rate_hz_, target_level_ms);
+      &current_cng_rtp_payload_type_, stats_.get());
   bool buffer_flush_occured = false;
   if (ret == PacketBuffer::kFlushed) {
     // Reset DSP timestamp etc. if packet buffer flushed.
     new_codec_ = true;
     update_sample_rate_and_channels = true;
     buffer_flush_occured = true;
-  } else if (ret == PacketBuffer::kPartialFlush) {
-    // Forward sync buffer timestamp
-    timestamp_ = packet_buffer_->PeekNextPacket()->timestamp;
-    sync_buffer_->IncreaseEndTimestamp(timestamp_ -
-                                       sync_buffer_->end_timestamp());
-    buffer_flush_occured = true;
   } else if (ret != PacketBuffer::kOK) {
     return kOtherError;
   }
diff --git a/modules/audio_coding/neteq/neteq_impl_unittest.cc b/modules/audio_coding/neteq/neteq_impl_unittest.cc
index e61cd52..192e99a 100644
--- a/modules/audio_coding/neteq/neteq_impl_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_impl_unittest.cc
@@ -330,7 +330,7 @@
   EXPECT_CALL(*mock_packet_buffer_, Empty())
       .WillOnce(Return(false));  // Called once after first packet is inserted.
   EXPECT_CALL(*mock_packet_buffer_, Flush(_)).Times(1);
-  EXPECT_CALL(*mock_packet_buffer_, InsertPacketList(_, _, _, _, _, _, _, _))
+  EXPECT_CALL(*mock_packet_buffer_, InsertPacketList(_, _, _, _, _))
       .Times(2)
       .WillRepeatedly(DoAll(SetArgPointee<2>(kPayloadType),
                             WithArg<0>(Invoke(DeletePacketsAndReturnOk))));
diff --git a/modules/audio_coding/neteq/packet_buffer.cc b/modules/audio_coding/neteq/packet_buffer.cc
index 9bfa908..b66f49a 100644
--- a/modules/audio_coding/neteq/packet_buffer.cc
+++ b/modules/audio_coding/neteq/packet_buffer.cc
@@ -63,34 +63,11 @@
   }
 }
 
-absl::optional<SmartFlushingConfig> GetSmartflushingConfig() {
-  absl::optional<SmartFlushingConfig> result;
-  std::string field_trial_string =
-      field_trial::FindFullName("WebRTC-Audio-NetEqSmartFlushing");
-  result = SmartFlushingConfig();
-  bool enabled = false;
-  auto parser = StructParametersParser::Create(
-      "enabled", &enabled, "target_level_threshold_ms",
-      &result->target_level_threshold_ms, "target_level_multiplier",
-      &result->target_level_multiplier);
-  parser->Parse(field_trial_string);
-  if (!enabled) {
-    return absl::nullopt;
-  }
-  RTC_LOG(LS_INFO) << "Using smart flushing, target_level_threshold_ms: "
-                   << result->target_level_threshold_ms
-                   << ", target_level_multiplier: "
-                   << result->target_level_multiplier;
-  return result;
-}
-
 }  // namespace
 
 PacketBuffer::PacketBuffer(size_t max_number_of_packets,
                            const TickTimer* tick_timer)
-    : smart_flushing_config_(GetSmartflushingConfig()),
-      max_number_of_packets_(max_number_of_packets),
-      tick_timer_(tick_timer) {}
+    : max_number_of_packets_(max_number_of_packets), tick_timer_(tick_timer) {}
 
 // Destructor. All packets in the buffer will be destroyed.
 PacketBuffer::~PacketBuffer() {
@@ -106,37 +83,11 @@
   stats->FlushedPacketBuffer();
 }
 
-void PacketBuffer::PartialFlush(int target_level_ms,
-                                size_t sample_rate,
-                                size_t last_decoded_length,
-                                StatisticsCalculator* stats) {
-  // Make sure that at least half the packet buffer capacity will be available
-  // after the flush. This is done to avoid getting stuck if the target level is
-  // very high.
-  int target_level_samples =
-      std::min(target_level_ms * sample_rate / 1000,
-               max_number_of_packets_ * last_decoded_length / 2);
-  // We should avoid flushing to very low levels.
-  target_level_samples = std::max(
-      target_level_samples, smart_flushing_config_->target_level_threshold_ms);
-  while (GetSpanSamples(last_decoded_length, sample_rate, false) >
-             static_cast<size_t>(target_level_samples) ||
-         buffer_.size() > max_number_of_packets_ / 2) {
-    LogPacketDiscarded(PeekNextPacket()->priority.codec_level, stats);
-    buffer_.pop_front();
-  }
-}
-
 bool PacketBuffer::Empty() const {
   return buffer_.empty();
 }
 
-int PacketBuffer::InsertPacket(Packet&& packet,
-                               StatisticsCalculator* stats,
-                               size_t last_decoded_length,
-                               size_t sample_rate,
-                               int target_level_ms,
-                               const DecoderDatabase& decoder_database) {
+int PacketBuffer::InsertPacket(Packet&& packet, StatisticsCalculator* stats) {
   if (packet.empty()) {
     RTC_LOG(LS_WARNING) << "InsertPacket invalid packet";
     return kInvalidPacket;
@@ -149,32 +100,11 @@
 
   packet.waiting_time = tick_timer_->GetNewStopwatch();
 
-  // Perform a smart flush if the buffer size exceeds a multiple of the target
-  // level.
-  const size_t span_threshold =
-      smart_flushing_config_
-          ? smart_flushing_config_->target_level_multiplier *
-                std::max(smart_flushing_config_->target_level_threshold_ms,
-                         target_level_ms) *
-                sample_rate / 1000
-          : 0;
-  const bool smart_flush =
-      smart_flushing_config_.has_value() &&
-      GetSpanSamples(last_decoded_length, sample_rate, false) >= span_threshold;
-  if (buffer_.size() >= max_number_of_packets_ || smart_flush) {
-    size_t buffer_size_before_flush = buffer_.size();
-    if (smart_flushing_config_.has_value()) {
-      // Flush down to the target level.
-      PartialFlush(target_level_ms, sample_rate, last_decoded_length, stats);
-      return_val = kPartialFlush;
-    } else {
-      // Buffer is full.
-      Flush(stats);
-      return_val = kFlushed;
-    }
-    RTC_LOG(LS_WARNING) << "Packet buffer flushed, "
-                        << (buffer_size_before_flush - buffer_.size())
-                        << " packets discarded.";
+  if (buffer_.size() >= max_number_of_packets_) {
+    // Buffer is full.
+    Flush(stats);
+    return_val = kFlushed;
+    RTC_LOG(LS_WARNING) << "Packet buffer flushed.";
   }
 
   // Get an iterator pointing to the place in the buffer where the new packet
@@ -209,10 +139,7 @@
     const DecoderDatabase& decoder_database,
     absl::optional<uint8_t>* current_rtp_payload_type,
     absl::optional<uint8_t>* current_cng_rtp_payload_type,
-    StatisticsCalculator* stats,
-    size_t last_decoded_length,
-    size_t sample_rate,
-    int target_level_ms) {
+    StatisticsCalculator* stats) {
   RTC_DCHECK(stats);
   bool flushed = false;
   for (auto& packet : *packet_list) {
@@ -239,9 +166,7 @@
       }
       *current_rtp_payload_type = packet.payload_type;
     }
-    int return_val =
-        InsertPacket(std::move(packet), stats, last_decoded_length, sample_rate,
-                     target_level_ms, decoder_database);
+    int return_val = InsertPacket(std::move(packet), stats);
     if (return_val == kFlushed) {
       // The buffer flushed, but this is not an error. We can still continue.
       flushed = true;
diff --git a/modules/audio_coding/neteq/packet_buffer.h b/modules/audio_coding/neteq/packet_buffer.h
index 1eef64a..1359307 100644
--- a/modules/audio_coding/neteq/packet_buffer.h
+++ b/modules/audio_coding/neteq/packet_buffer.h
@@ -21,14 +21,6 @@
 class DecoderDatabase;
 class StatisticsCalculator;
 class TickTimer;
-struct SmartFlushingConfig {
-  // When calculating the flushing threshold, the maximum between the target
-  // level and this value is used.
-  int target_level_threshold_ms = 500;
-  // A smart flush is triggered when the packet buffer contains a multiple of
-  // the target level.
-  int target_level_multiplier = 3;
-};
 
 // This is the actual buffer holding the packets before decoding.
 class PacketBuffer {
@@ -36,7 +28,6 @@
   enum BufferReturnCodes {
     kOK = 0,
     kFlushed,
-    kPartialFlush,
     kNotFound,
     kBufferEmpty,
     kInvalidPacket,
@@ -56,12 +47,6 @@
   // Flushes the buffer and deletes all packets in it.
   virtual void Flush(StatisticsCalculator* stats);
 
-  // Partial flush. Flush packets but leave some packets behind.
-  virtual void PartialFlush(int target_level_ms,
-                            size_t sample_rate,
-                            size_t last_decoded_length,
-                            StatisticsCalculator* stats);
-
   // Returns true for an empty buffer.
   virtual bool Empty() const;
 
@@ -69,12 +54,7 @@
   // the packet object.
   // Returns PacketBuffer::kOK on success, PacketBuffer::kFlushed if the buffer
   // was flushed due to overfilling.
-  virtual int InsertPacket(Packet&& packet,
-                           StatisticsCalculator* stats,
-                           size_t last_decoded_length,
-                           size_t sample_rate,
-                           int target_level_ms,
-                           const DecoderDatabase& decoder_database);
+  virtual int InsertPacket(Packet&& packet, StatisticsCalculator* stats);
 
   // Inserts a list of packets into the buffer. The buffer will take over
   // ownership of the packet objects.
@@ -89,10 +69,7 @@
       const DecoderDatabase& decoder_database,
       absl::optional<uint8_t>* current_rtp_payload_type,
       absl::optional<uint8_t>* current_cng_rtp_payload_type,
-      StatisticsCalculator* stats,
-      size_t last_decoded_length,
-      size_t sample_rate,
-      int target_level_ms);
+      StatisticsCalculator* stats);
 
   // Gets the timestamp for the first packet in the buffer and writes it to the
   // output variable `next_timestamp`.
@@ -171,7 +148,6 @@
   }
 
  private:
-  absl::optional<SmartFlushingConfig> smart_flushing_config_;
   size_t max_number_of_packets_;
   PacketList buffer_;
   const TickTimer* tick_timer_;
diff --git a/modules/audio_coding/neteq/packet_buffer_unittest.cc b/modules/audio_coding/neteq/packet_buffer_unittest.cc
index b007964..9f2bf63 100644
--- a/modules/audio_coding/neteq/packet_buffer_unittest.cc
+++ b/modules/audio_coding/neteq/packet_buffer_unittest.cc
@@ -123,11 +123,7 @@
   const int payload_len = 100;
   const Packet packet = gen.NextPacket(payload_len, nullptr);
   EXPECT_EQ(0, buffer.InsertPacket(/*packet=*/packet.Clone(),
-                                   /*stats=*/&mock_stats,
-                                   /*last_decoded_length=*/payload_len,
-                                   /*sample_rate=*/10000,
-                                   /*target_level_ms=*/60,
-                                   /*decoder_database=*/decoder_database));
+                                   /*stats=*/&mock_stats));
   uint32_t next_ts;
   EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
   EXPECT_EQ(4711u, next_ts);
@@ -152,14 +148,9 @@
 
   // Insert 10 small packets; should be ok.
   for (int i = 0; i < 10; ++i) {
-    EXPECT_EQ(
-        PacketBuffer::kOK,
-        buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
-                            /*stats=*/&mock_stats,
-                            /*last_decoded_length=*/payload_len,
-                            /*sample_rate=*/1000,
-                            /*target_level_ms=*/60,
-                            /*decoder_database=*/decoder_database));
+    EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(/*packet=*/gen.NextPacket(
+                                                         payload_len, nullptr),
+                                                     /*stats=*/&mock_stats));
   }
   EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
   EXPECT_FALSE(buffer.Empty());
@@ -184,14 +175,9 @@
   const int payload_len = 10;
   int i;
   for (i = 0; i < 10; ++i) {
-    EXPECT_EQ(
-        PacketBuffer::kOK,
-        buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
-                            /*stats=*/&mock_stats,
-                            /*last_decoded_length=*/payload_len,
-                            /*sample_rate=*/1000,
-                            /*target_level_ms=*/60,
-                            /*decoder_database=*/decoder_database));
+    EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(/*packet=*/gen.NextPacket(
+                                                         payload_len, nullptr),
+                                                     /*stats=*/&mock_stats));
   }
   EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
   uint32_t next_ts;
@@ -203,11 +189,7 @@
   // Insert 11th packet; should flush the buffer and insert it after flushing.
   EXPECT_EQ(PacketBuffer::kFlushed,
             buffer.InsertPacket(/*packet=*/packet.Clone(),
-                                /*stats=*/&mock_stats,
-                                /*last_decoded_length=*/payload_len,
-                                /*sample_rate=*/1000,
-                                /*target_level_ms=*/60,
-                                /*decoder_database=*/decoder_database));
+                                /*stats=*/&mock_stats));
   EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
   EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
   // Expect last inserted packet to be first in line.
@@ -216,90 +198,6 @@
   EXPECT_CALL(decoder_database, Die());  // Called when object is deleted.
 }
 
-// Test a partial buffer flush.
-TEST(PacketBuffer, PartialFlush) {
-  // Use a field trial to configure smart flushing.
-  test::ScopedFieldTrials field_trials(
-      "WebRTC-Audio-NetEqSmartFlushing/enabled:true,"
-      "target_level_threshold_ms:0,target_level_multiplier:2/");
-  TickTimer tick_timer;
-  PacketBuffer buffer(10, &tick_timer);  // 10 packets.
-  PacketGenerator gen(0, 0, 0, 10);
-  const int payload_len = 10;
-  StrictMock<MockStatisticsCalculator> mock_stats;
-  MockDecoderDatabase decoder_database;
-
-  // Insert 10 small packets; should be ok.
-  for (int i = 0; i < 10; ++i) {
-    EXPECT_EQ(
-        PacketBuffer::kOK,
-        buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
-                            /*stats=*/&mock_stats,
-                            /*last_decoded_length=*/payload_len,
-                            /*sample_rate=*/1000,
-                            /*target_level_ms=*/100,
-                            /*decoder_database=*/decoder_database));
-  }
-  EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
-  EXPECT_FALSE(buffer.Empty());
-
-  EXPECT_CALL(mock_stats, PacketsDiscarded(1)).Times(7);
-  buffer.PartialFlush(/*target_level_ms=*/30,
-                      /*sample_rate=*/1000,
-                      /*last_decoded_length=*/payload_len,
-                      /*stats=*/&mock_stats);
-  // There should still be some packets left in the buffer.
-  EXPECT_EQ(3u, buffer.NumPacketsInBuffer());
-  EXPECT_FALSE(buffer.Empty());
-  EXPECT_CALL(decoder_database, Die());  // Called when object is deleted.
-}
-
-// Test to fill the buffer over the limits, and verify that the smart flush
-// functionality works as expected.
-TEST(PacketBuffer, SmartFlushOverfillBuffer) {
-  // Use a field trial to configure smart flushing.
-  test::ScopedFieldTrials field_trials(
-      "WebRTC-Audio-NetEqSmartFlushing/enabled:true,"
-      "target_level_threshold_ms:0,target_level_multiplier:2/");
-  TickTimer tick_timer;
-  PacketBuffer buffer(10, &tick_timer);  // 10 packets.
-  PacketGenerator gen(0, 0, 0, 10);
-  StrictMock<MockStatisticsCalculator> mock_stats;
-  MockDecoderDatabase decoder_database;
-
-  // Insert 10 small packets; should be ok.
-  const int payload_len = 10;
-  int i;
-  for (i = 0; i < 10; ++i) {
-    EXPECT_EQ(
-        PacketBuffer::kOK,
-        buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
-                            /*stats=*/&mock_stats,
-                            /*last_decoded_length=*/payload_len,
-                            /*sample_rate=*/1000,
-                            /*target_level_ms=*/100,
-                            /*decoder_database=*/decoder_database));
-  }
-  EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
-  uint32_t next_ts;
-  EXPECT_EQ(PacketBuffer::kOK, buffer.NextTimestamp(&next_ts));
-  EXPECT_EQ(0u, next_ts);  // Expect first inserted packet to be first in line.
-
-  const Packet packet = gen.NextPacket(payload_len, nullptr);
-  EXPECT_CALL(mock_stats, PacketsDiscarded(1)).Times(6);
-  // Insert 11th packet; should cause a partial flush and insert the packet
-  // after flushing.
-  EXPECT_EQ(PacketBuffer::kPartialFlush,
-            buffer.InsertPacket(/*packet=*/packet.Clone(),
-                                /*stats=*/&mock_stats,
-                                /*last_decoded_length=*/payload_len,
-                                /*sample_rate=*/1000,
-                                /*target_level_ms=*/40,
-                                /*decoder_database=*/decoder_database));
-  EXPECT_EQ(5u, buffer.NumPacketsInBuffer());
-  EXPECT_CALL(decoder_database, Die());  // Called when object is deleted.
-}
-
 // Test inserting a list of packets.
 TEST(PacketBuffer, InsertPacketList) {
   TickTimer tick_timer;
@@ -330,10 +228,7 @@
                               /*decoder_database=*/decoder_database,
                               /*current_rtp_payload_type=*/&current_pt,
                               /*current_cng_rtp_payload_type=*/&current_cng_pt,
-                              /*stats=*/&mock_stats,
-                              /*last_decoded_length=*/payload_len,
-                              /*sample_rate=*/1000,
-                              /*target_level_ms=*/30));
+                              /*stats=*/&mock_stats));
   EXPECT_TRUE(list.empty());  // The PacketBuffer should have depleted the list.
   EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
   EXPECT_EQ(0, current_pt);  // Current payload type changed to 0.
@@ -385,10 +280,7 @@
                               /*decoder_database=*/decoder_database,
                               /*current_rtp_payload_type=*/&current_pt,
                               /*current_cng_rtp_payload_type=*/&current_cng_pt,
-                              /*stats=*/&mock_stats,
-                              /*last_decoded_length=*/payload_len,
-                              /*sample_rate=*/1000,
-                              /*target_level_ms=*/30));
+                              /*stats=*/&mock_stats));
   EXPECT_TRUE(list.empty());  // The PacketBuffer should have depleted the list.
   EXPECT_EQ(1u, buffer.NumPacketsInBuffer());  // Only the last packet.
   EXPECT_EQ(1, current_pt);  // Current payload type changed to 1.
@@ -443,13 +335,8 @@
       }
     }
     EXPECT_CALL(check, Call(i));
-    EXPECT_EQ(PacketBuffer::kOK,
-              buffer.InsertPacket(/*packet=*/packet.Clone(),
-                                  /*stats=*/&mock_stats,
-                                  /*last_decoded_length=*/kPayloadLength,
-                                  /*sample_rate=*/1000,
-                                  /*target_level_ms=*/60,
-                                  /*decoder_database=*/decoder_database));
+    EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(/*packet=*/packet.Clone(),
+                                                     /*stats=*/&mock_stats));
     if (packet_facts[i].extract_order >= 0) {
       expect_order[packet_facts[i].extract_order] = std::move(packet);
     }
@@ -482,11 +369,7 @@
   // Insert 10 small packets.
   for (int i = 0; i < kTotalPackets; ++i) {
     buffer.InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
-                        /*stats=*/&mock_stats,
-                        /*last_decoded_length=*/payload_len,
-                        /*sample_rate=*/1000,
-                        /*target_level_ms=*/60,
-                        /*decoder_database=*/decoder_database);
+                        /*stats=*/&mock_stats);
   }
   EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
 
@@ -576,10 +459,7 @@
                               /*decoder_database=*/decoder_database,
                               /*current_rtp_payload_type=*/&current_pt,
                               /*current_cng_rtp_payload_type=*/&current_cng_pt,
-                              /*stats=*/&mock_stats,
-                              /*last_decoded_length=*/payload_len,
-                              /*sample_rate=*/1000,
-                              /*target_level_ms=*/30));
+                              /*stats=*/&mock_stats));
   EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
 
   // Extract them and make sure that come out in the right order.
@@ -632,10 +512,7 @@
                               /*decoder_database=*/decoder_database,
                               /*current_rtp_payload_type=*/&current_pt,
                               /*current_cng_rtp_payload_type=*/&current_cng_pt,
-                              /*stats=*/&mock_stats,
-                              /*last_decoded_length=*/kPayloadLen,
-                              /*sample_rate=*/1000,
-                              /*target_level_ms=*/30));
+                              /*stats=*/&mock_stats));
   EXPECT_TRUE(list.empty());
   EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
   ASSERT_TRUE(buffer.PeekNextPacket());
@@ -658,10 +535,7 @@
                               /*decoder_database=*/decoder_database,
                               /*current_rtp_payload_type=*/&current_pt,
                               /*current_cng_rtp_payload_type=*/&current_cng_pt,
-                              /*stats=*/&mock_stats,
-                              /*last_decoded_length=*/kPayloadLen,
-                              /*sample_rate=*/1000,
-                              /*target_level_ms=*/30));
+                              /*stats=*/&mock_stats));
   EXPECT_TRUE(list.empty());
   EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
   ASSERT_TRUE(buffer.PeekNextPacket());
@@ -689,11 +563,7 @@
     packet.payload.Clear();
     EXPECT_EQ(PacketBuffer::kInvalidPacket,
               buffer->InsertPacket(/*packet=*/std::move(packet),
-                                   /*stats=*/&mock_stats,
-                                   /*last_decoded_length=*/payload_len,
-                                   /*sample_rate=*/1000,
-                                   /*target_level_ms=*/60,
-                                   /*decoder_database=*/decoder_database));
+                                   /*stats=*/&mock_stats));
   }
   // Buffer should still be empty. Test all empty-checks.
   uint32_t temp_ts;
@@ -709,14 +579,9 @@
   buffer->DiscardAllOldPackets(0, &mock_stats);
 
   // Insert one packet to make the buffer non-empty.
-  EXPECT_EQ(
-      PacketBuffer::kOK,
-      buffer->InsertPacket(/*packet=*/gen.NextPacket(payload_len, nullptr),
-                           /*stats=*/&mock_stats,
-                           /*last_decoded_length=*/payload_len,
-                           /*sample_rate=*/1000,
-                           /*target_level_ms=*/60,
-                           /*decoder_database=*/decoder_database));
+  EXPECT_EQ(PacketBuffer::kOK, buffer->InsertPacket(/*packet=*/gen.NextPacket(
+                                                        payload_len, nullptr),
+                                                    /*stats=*/&mock_stats));
   EXPECT_EQ(PacketBuffer::kInvalidPointer, buffer->NextTimestamp(NULL));
   EXPECT_EQ(PacketBuffer::kInvalidPointer,
             buffer->NextHigherTimestamp(0, NULL));
@@ -747,10 +612,7 @@
                                /*decoder_database=*/decoder_database,
                                /*current_rtp_payload_type=*/&current_pt,
                                /*current_cng_rtp_payload_type=*/&current_cng_pt,
-                               /*stats=*/&mock_stats,
-                               /*last_decoded_length=*/payload_len,
-                               /*sample_rate=*/1000,
-                               /*target_level_ms=*/30));
+                               /*stats=*/&mock_stats));
   EXPECT_TRUE(list.empty());  // The PacketBuffer should have depleted the list.
   EXPECT_EQ(1u, buffer->NumPacketsInBuffer());
   delete buffer;
@@ -892,11 +754,7 @@
 
   EXPECT_EQ(PacketBuffer::kOK,
             buffer.InsertPacket(/*packet=*/std::move(packet_1),
-                                /*stats=*/&mock_stats,
-                                /*last_decoded_length=*/kFrameSizeSamples,
-                                /*sample_rate=*/1000,
-                                /*target_level_ms=*/60,
-                                /*decoder_database=*/decoder_database));
+                                /*stats=*/&mock_stats));
 
   constexpr size_t kLastDecodedSizeSamples = 2;
   // packet_1 has no access to duration, and relies last decoded duration as
@@ -907,11 +765,7 @@
 
   EXPECT_EQ(PacketBuffer::kOK,
             buffer.InsertPacket(/*packet=*/std::move(packet_2),
-                                /*stats=*/&mock_stats,
-                                /*last_decoded_length=*/kFrameSizeSamples,
-                                /*sample_rate=*/1000,
-                                /*target_level_ms=*/60,
-                                /*decoder_database=*/decoder_database));
+                                /*stats=*/&mock_stats));
 
   EXPECT_EQ(kFrameSizeSamples * 2,
             buffer.GetSpanSamples(0, kSampleRateHz, kCountWaitingTime));
@@ -938,13 +792,8 @@
 
   Packet packet = gen.NextPacket(kPayloadSizeBytes, nullptr);
 
-  EXPECT_EQ(PacketBuffer::kOK,
-            buffer.InsertPacket(/*packet=*/std::move(packet),
-                                /*stats=*/&mock_stats,
-                                /*last_decoded_length=*/kFrameSizeSamples,
-                                /*sample_rate=*/kSampleRateHz,
-                                /*target_level_ms=*/60,
-                                /*decoder_database=*/decoder_database));
+  EXPECT_EQ(PacketBuffer::kOK, buffer.InsertPacket(/*packet=*/std::move(packet),
+                                                   /*stats=*/&mock_stats));
 
   EXPECT_EQ(0u, buffer.GetSpanSamples(kLastDecodedSizeSamples, kSampleRateHz,
                                       kCountWaitingTime));