NetEq: Use TickTimer in PacketBuffer
This change makes use of the TickTimer::Stopwatch in Packets. When a
packet is inserted into the PacketBuffer, a Stopwatch object is
attached to it. When the packet is extracted from the buffer, the
Stopwatch is read to know how long the packet waited in the buffer.
BUG=webrtc:5608
Review URL: https://codereview.webrtc.org/1917913002
Cr-Commit-Position: refs/heads/master@{#12508}
diff --git a/webrtc/modules/audio_coding/neteq/packet_buffer.h b/webrtc/modules/audio_coding/neteq/packet_buffer.h
index 03c11e6..6867b4c 100644
--- a/webrtc/modules/audio_coding/neteq/packet_buffer.h
+++ b/webrtc/modules/audio_coding/neteq/packet_buffer.h
@@ -17,8 +17,8 @@
namespace webrtc {
-// Forward declaration.
class DecoderDatabase;
+class TickTimer;
// This is the actual buffer holding the packets before decoding.
class PacketBuffer {
@@ -34,7 +34,7 @@
// Constructor creates a buffer which can hold a maximum of
// |max_number_of_packets| packets.
- PacketBuffer(size_t max_number_of_packets);
+ PacketBuffer(size_t max_number_of_packets, const TickTimer* tick_timer);
// Deletes all packets in the buffer before destroying the buffer.
virtual ~PacketBuffer();
@@ -116,10 +116,6 @@
virtual size_t NumSamplesInBuffer(DecoderDatabase* decoder_database,
size_t last_decoded_length) const;
- // Increase the waiting time counter for every packet in the buffer by |inc|.
- // The default value for |inc| is 1.
- virtual void IncrementWaitingTimes(int inc = 1);
-
virtual void BufferStat(int* num_packets, int* max_num_packets) const;
// Static method that properly deletes the first packet, and its payload
@@ -148,6 +144,7 @@
private:
size_t max_number_of_packets_;
PacketList buffer_;
+ const TickTimer* tick_timer_;
RTC_DISALLOW_COPY_AND_ASSIGN(PacketBuffer);
};