Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: webrtc/modules/audio_coding/neteq/packet_buffer.cc

Issue 1917913002: NetEq: Use TickTimer in PacketBuffer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@add-tick-timer-to-neteq
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/packet_buffer.cc
diff --git a/webrtc/modules/audio_coding/neteq/packet_buffer.cc b/webrtc/modules/audio_coding/neteq/packet_buffer.cc
index c89de12318b990ed4b3df4344cac2c0ef5e5f8a4..849e48c0064eedff2aa1a0a9c3f39591a181f1fb 100644
--- a/webrtc/modules/audio_coding/neteq/packet_buffer.cc
+++ b/webrtc/modules/audio_coding/neteq/packet_buffer.cc
@@ -19,6 +19,7 @@
#include "webrtc/base/logging.h"
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
+#include "webrtc/modules/audio_coding/neteq/tick_timer.h"
namespace webrtc {
@@ -37,8 +38,9 @@ class NewTimestampIsLarger {
const Packet* new_packet_;
};
-PacketBuffer::PacketBuffer(size_t max_number_of_packets)
- : max_number_of_packets_(max_number_of_packets) {}
+PacketBuffer::PacketBuffer(size_t max_number_of_packets,
+ const TickTimer& tick_timer)
+ : max_number_of_packets_(max_number_of_packets), tick_timer_(tick_timer) {}
kwiberg-webrtc 2016/04/26 09:04:13 This looks a bit evil; to callers, it looks like t
hlundin-webrtc 2016/04/26 11:05:54 Yes, it would be inconvenient, since the ownership
kwiberg-webrtc 2016/04/26 11:26:27 Yes, that's much better than passing it by const r
hlundin-webrtc 2016/04/26 11:56:28 Done.
// Destructor. All packets in the buffer will be destroyed.
PacketBuffer::~PacketBuffer() {
@@ -65,6 +67,8 @@ int PacketBuffer::InsertPacket(Packet* packet) {
int return_val = kOK;
+ packet->waiting_time = tick_timer_.GetNewStopwatch();
+
if (buffer_.size() >= max_number_of_packets_) {
// Buffer is full. Flush it.
Flush();
@@ -268,13 +272,6 @@ size_t PacketBuffer::NumSamplesInBuffer(DecoderDatabase* decoder_database,
return num_samples;
}
-void PacketBuffer::IncrementWaitingTimes(int inc) {
- PacketList::iterator it;
- for (it = buffer_.begin(); it != buffer_.end(); ++it) {
- (*it)->waiting_time += inc;
- }
-}
-
bool PacketBuffer::DeleteFirstPacket(PacketList* packet_list) {
if (packet_list->empty()) {
return false;

Powered by Google App Engine
This is Rietveld 408576698