| 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 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 Loading... |
| 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_ |
| OLD | NEW |