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

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

Issue 1903043003: WIP: Adding a centralized NetEq Clock (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-remove-type-param
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) {}
// 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;
« no previous file with comments | « webrtc/modules/audio_coding/neteq/packet_buffer.h ('k') | webrtc/modules/audio_coding/neteq/packet_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698