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

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

Issue 2425223002: NetEq now works with packets as values, rather than pointers. (Closed)
Patch Set: Compare packets better in test. One more const. Created 4 years, 2 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
« no previous file with comments | « webrtc/modules/audio_coding/neteq/packet.cc ('k') | webrtc/modules/audio_coding/neteq/packet_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/packet_buffer.h
diff --git a/webrtc/modules/audio_coding/neteq/packet_buffer.h b/webrtc/modules/audio_coding/neteq/packet_buffer.h
index 63e006c1d545dc05e81d6171bbf2c13625d74565..a26d6c5c671daef9e982eb1f7773a35764345266 100644
--- a/webrtc/modules/audio_coding/neteq/packet_buffer.h
+++ b/webrtc/modules/audio_coding/neteq/packet_buffer.h
@@ -51,7 +51,7 @@ class PacketBuffer {
// the packet object.
// Returns PacketBuffer::kOK on success, PacketBuffer::kFlushed if the buffer
// was flushed due to overfilling.
- virtual int InsertPacket(Packet* packet);
+ virtual int InsertPacket(Packet&& packet);
// Inserts a list of packets into the buffer. The buffer will take over
// ownership of the packet objects.
@@ -85,13 +85,9 @@ class PacketBuffer {
// NULL if the buffer is empty.
virtual const Packet* PeekNextPacket() const;
- // Extracts the first packet in the buffer and returns a pointer to it.
- // Returns NULL if the buffer is empty. The caller is responsible for deleting
- // the packet.
- // Subsequent packets with the same timestamp as the one extracted will be
- // discarded and properly deleted. The number of discarded packets will be
- // written to the output variable |discard_count|.
- virtual Packet* GetNextPacket(size_t* discard_count);
+ // Extracts the first packet in the buffer and returns it.
+ // Returns an empty optional if the buffer is empty.
+ virtual rtc::Optional<Packet> GetNextPacket();
// Discards the first packet in the buffer. The packet is deleted.
// Returns PacketBuffer::kBufferEmpty if the buffer is empty,
@@ -123,15 +119,6 @@ class PacketBuffer {
virtual void BufferStat(int* num_packets, int* max_num_packets) const;
- // Static method that properly deletes the first packet, and its payload
- // array, in |packet_list|. Returns false if |packet_list| already was empty,
- // otherwise true.
- static bool DeleteFirstPacket(PacketList* packet_list);
-
- // Static method that properly deletes all packets, and their payload arrays,
- // in |packet_list|.
- static void DeleteAllPackets(PacketList* packet_list);
-
// Static method returning true if |timestamp| is older than |timestamp_limit|
// but less than |horizon_samples| behind |timestamp_limit|. For instance,
// with timestamp_limit = 100 and horizon_samples = 10, a timestamp in the
« no previous file with comments | « webrtc/modules/audio_coding/neteq/packet.cc ('k') | webrtc/modules/audio_coding/neteq/packet_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698