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

Side by Side Diff: webrtc/modules/audio_coding/neteq/packet.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, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 uint32_t timestamp; 68 uint32_t timestamp;
69 uint16_t sequence_number; 69 uint16_t sequence_number;
70 uint8_t payload_type; 70 uint8_t payload_type;
71 // Datagram excluding RTP header and header extension. 71 // Datagram excluding RTP header and header extension.
72 rtc::Buffer payload; 72 rtc::Buffer payload;
73 Priority priority; 73 Priority priority;
74 std::unique_ptr<TickTimer::Stopwatch> waiting_time; 74 std::unique_ptr<TickTimer::Stopwatch> waiting_time;
75 std::unique_ptr<AudioDecoder::EncodedAudioFrame> frame; 75 std::unique_ptr<AudioDecoder::EncodedAudioFrame> frame;
76 76
77 Packet(); 77 Packet();
78 Packet(Packet&& b);
78 ~Packet(); 79 ~Packet();
79 80
81 // Packets should generally be moved around but sometimes it's useful to make
82 // a copy, for example for testing purposes. NOTE: Will only work for
83 // un-parsed packets, i.e. |frame| must be unset. The payload will, however,
84 // be copied. |waiting_time| will also not be copied.
85 Packet Clone() const;
86
87 Packet& operator=(Packet&& b);
88
80 // Comparison operators. Establish a packet ordering based on (1) timestamp, 89 // Comparison operators. Establish a packet ordering based on (1) timestamp,
81 // (2) sequence number and (3) redundancy. 90 // (2) sequence number and (3) redundancy.
82 // Timestamp and sequence numbers are compared taking wrap-around into 91 // Timestamp and sequence numbers are compared taking wrap-around into
83 // account. For two packets with the same sequence number and timestamp a 92 // account. For two packets with the same sequence number and timestamp a
84 // primary payload is considered "smaller" than a secondary. 93 // primary payload is considered "smaller" than a secondary.
85 bool operator==(const Packet& rhs) const { 94 bool operator==(const Packet& rhs) const {
86 return (this->timestamp == rhs.timestamp && 95 return (this->timestamp == rhs.timestamp &&
87 this->sequence_number == rhs.sequence_number && 96 this->sequence_number == rhs.sequence_number &&
88 this->priority == rhs.priority); 97 this->priority == rhs.priority);
89 } 98 }
(...skipping 12 matching lines...) Expand all
102 0xFFFFFFFF / 2); 111 0xFFFFFFFF / 2);
103 } 112 }
104 bool operator>(const Packet& rhs) const { return rhs.operator<(*this); } 113 bool operator>(const Packet& rhs) const { return rhs.operator<(*this); }
105 bool operator<=(const Packet& rhs) const { return !operator>(rhs); } 114 bool operator<=(const Packet& rhs) const { return !operator>(rhs); }
106 bool operator>=(const Packet& rhs) const { return !operator<(rhs); } 115 bool operator>=(const Packet& rhs) const { return !operator<(rhs); }
107 116
108 bool empty() const { return !frame && payload.empty(); } 117 bool empty() const { return !frame && payload.empty(); }
109 }; 118 };
110 119
111 // A list of packets. 120 // A list of packets.
112 typedef std::list<Packet*> PacketList; 121 typedef std::list<Packet> PacketList;
113 122
114 } // namespace webrtc 123 } // namespace webrtc
115 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_H_ 124 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/packet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698