OLD | NEW |
---|---|
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 Loading... | |
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 | |
kwiberg-webrtc
2016/10/20 22:39:22
Why the extra blank line?
ossu
2016/10/21 12:54:41
To give the reader some time to breathe! (fixed)
| |
79 Packet(Packet&& b); | |
78 ~Packet(); | 80 ~Packet(); |
79 | 81 |
82 // Packets should generally be moved around but sometimes it's useful to make | |
83 // a copy, for example for testing purposes. NOTE: Will only work for | |
84 // un-parsed packets, i.e. |frame| must be unset. The payload will, however, | |
85 // be copied. |waiting_time| will also not be copied. | |
86 Packet Clone() const; | |
87 | |
88 Packet& operator=(Packet&& b); | |
89 | |
80 // Comparison operators. Establish a packet ordering based on (1) timestamp, | 90 // Comparison operators. Establish a packet ordering based on (1) timestamp, |
81 // (2) sequence number and (3) redundancy. | 91 // (2) sequence number and (3) redundancy. |
82 // Timestamp and sequence numbers are compared taking wrap-around into | 92 // Timestamp and sequence numbers are compared taking wrap-around into |
83 // account. For two packets with the same sequence number and timestamp a | 93 // account. For two packets with the same sequence number and timestamp a |
84 // primary payload is considered "smaller" than a secondary. | 94 // primary payload is considered "smaller" than a secondary. |
85 bool operator==(const Packet& rhs) const { | 95 bool operator==(const Packet& rhs) const { |
86 return (this->timestamp == rhs.timestamp && | 96 return (this->timestamp == rhs.timestamp && |
87 this->sequence_number == rhs.sequence_number && | 97 this->sequence_number == rhs.sequence_number && |
88 this->priority == rhs.priority); | 98 this->priority == rhs.priority); |
89 } | 99 } |
(...skipping 12 matching lines...) Expand all Loading... | |
102 0xFFFFFFFF / 2); | 112 0xFFFFFFFF / 2); |
103 } | 113 } |
104 bool operator>(const Packet& rhs) const { return rhs.operator<(*this); } | 114 bool operator>(const Packet& rhs) const { return rhs.operator<(*this); } |
105 bool operator<=(const Packet& rhs) const { return !operator>(rhs); } | 115 bool operator<=(const Packet& rhs) const { return !operator>(rhs); } |
106 bool operator>=(const Packet& rhs) const { return !operator<(rhs); } | 116 bool operator>=(const Packet& rhs) const { return !operator<(rhs); } |
107 | 117 |
108 bool empty() const { return !frame && payload.empty(); } | 118 bool empty() const { return !frame && payload.empty(); } |
109 }; | 119 }; |
110 | 120 |
111 // A list of packets. | 121 // A list of packets. |
112 typedef std::list<Packet*> PacketList; | 122 typedef std::list<Packet> PacketList; |
113 | 123 |
114 } // namespace webrtc | 124 } // namespace webrtc |
115 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_H_ | 125 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_H_ |
OLD | NEW |