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.h b/webrtc/modules/audio_coding/neteq/packet.h
index 64b325e..d6f64c7 100644
--- a/webrtc/modules/audio_coding/neteq/packet.h
+++ b/webrtc/modules/audio_coding/neteq/packet.h
@@ -12,7 +12,9 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_H_
#include <list>
+#include <memory>
+#include "webrtc/modules/audio_coding/neteq/tick_timer.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/typedefs.h"
@@ -21,20 +23,15 @@
// Struct for holding RTP packets.
struct Packet {
RTPHeader header;
- uint8_t* payload; // Datagram excluding RTP header and header extension.
- size_t payload_length;
- bool primary; // Primary, i.e., not redundant payload.
- int waiting_time;
- bool sync_packet;
+ // Datagram excluding RTP header and header extension.
+ uint8_t* payload = nullptr;
+ size_t payload_length = 0;
+ bool primary = true; // Primary, i.e., not redundant payload.
+ bool sync_packet = false;
+ std::unique_ptr<TickTimer::Stopwatch> waiting_time;
- // Constructor.
- Packet()
- : payload(NULL),
- payload_length(0),
- primary(true),
- waiting_time(0),
- sync_packet(false) {
- }
+ Packet();
+ ~Packet();
// Comparison operators. Establish a packet ordering based on (1) timestamp,
// (2) sequence number, (3) regular packet vs sync-packet and (4) redundancy.