| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Returns a (constant) pointer the RTP header of the first packet in the | 81 // Returns a (constant) pointer the RTP header of the first packet in the |
| 82 // buffer. Returns NULL if the buffer is empty. | 82 // buffer. Returns NULL if the buffer is empty. |
| 83 virtual const RTPHeader* NextRtpHeader() const; | 83 virtual const RTPHeader* NextRtpHeader() const; |
| 84 | 84 |
| 85 // Extracts the first packet in the buffer and returns a pointer to it. | 85 // Extracts the first packet in the buffer and returns a pointer to it. |
| 86 // Returns NULL if the buffer is empty. The caller is responsible for deleting | 86 // Returns NULL if the buffer is empty. The caller is responsible for deleting |
| 87 // the packet. | 87 // the packet. |
| 88 // Subsequent packets with the same timestamp as the one extracted will be | 88 // Subsequent packets with the same timestamp as the one extracted will be |
| 89 // discarded and properly deleted. The number of discarded packets will be | 89 // discarded and properly deleted. The number of discarded packets will be |
| 90 // written to the output variable |discard_count|. | 90 // written to the output variable |discard_count|. |
| 91 virtual Packet* GetNextPacket(int* discard_count); | 91 virtual Packet* GetNextPacket(size_t* discard_count); |
| 92 | 92 |
| 93 // Discards the first packet in the buffer. The packet is deleted. | 93 // Discards the first packet in the buffer. The packet is deleted. |
| 94 // Returns PacketBuffer::kBufferEmpty if the buffer is empty, | 94 // Returns PacketBuffer::kBufferEmpty if the buffer is empty, |
| 95 // PacketBuffer::kOK otherwise. | 95 // PacketBuffer::kOK otherwise. |
| 96 virtual int DiscardNextPacket(); | 96 virtual int DiscardNextPacket(); |
| 97 | 97 |
| 98 // Discards all packets that are (strictly) older than timestamp_limit, | 98 // Discards all packets that are (strictly) older than timestamp_limit, |
| 99 // but newer than timestamp_limit - horizon_samples. Setting horizon_samples | 99 // but newer than timestamp_limit - horizon_samples. Setting horizon_samples |
| 100 // to zero implies that the horizon is set to half the timestamp range. That | 100 // to zero implies that the horizon is set to half the timestamp range. That |
| 101 // is, if a packet is more than 2^31 timestamps into the future compared with | 101 // is, if a packet is more than 2^31 timestamps into the future compared with |
| 102 // timestamp_limit (including wrap-around), it is considered old. | 102 // timestamp_limit (including wrap-around), it is considered old. |
| 103 // Returns number of packets discarded. | 103 // Returns number of packets discarded. |
| 104 virtual int DiscardOldPackets(uint32_t timestamp_limit, | 104 virtual int DiscardOldPackets(uint32_t timestamp_limit, |
| 105 uint32_t horizon_samples); | 105 uint32_t horizon_samples); |
| 106 | 106 |
| 107 // Discards all packets that are (strictly) older than timestamp_limit. | 107 // Discards all packets that are (strictly) older than timestamp_limit. |
| 108 virtual int DiscardAllOldPackets(uint32_t timestamp_limit); | 108 virtual int DiscardAllOldPackets(uint32_t timestamp_limit); |
| 109 | 109 |
| 110 // Returns the number of packets in the buffer, including duplicates and | 110 // Returns the number of packets in the buffer, including duplicates and |
| 111 // redundant packets. | 111 // redundant packets. |
| 112 virtual int NumPacketsInBuffer() const; | 112 virtual size_t NumPacketsInBuffer() const; |
| 113 | 113 |
| 114 // Returns the number of samples in the buffer, including samples carried in | 114 // Returns the number of samples in the buffer, including samples carried in |
| 115 // duplicate and redundant packets. | 115 // duplicate and redundant packets. |
| 116 virtual int NumSamplesInBuffer(DecoderDatabase* decoder_database, | 116 virtual size_t NumSamplesInBuffer(DecoderDatabase* decoder_database, |
| 117 int last_decoded_length) const; | 117 size_t last_decoded_length) const; |
| 118 | 118 |
| 119 // Increase the waiting time counter for every packet in the buffer by |inc|. | 119 // Increase the waiting time counter for every packet in the buffer by |inc|. |
| 120 // The default value for |inc| is 1. | 120 // The default value for |inc| is 1. |
| 121 virtual void IncrementWaitingTimes(int inc = 1); | 121 virtual void IncrementWaitingTimes(int inc = 1); |
| 122 | 122 |
| 123 virtual void BufferStat(int* num_packets, int* max_num_packets) const; | 123 virtual void BufferStat(int* num_packets, int* max_num_packets) const; |
| 124 | 124 |
| 125 // Static method that properly deletes the first packet, and its payload | 125 // Static method that properly deletes the first packet, and its payload |
| 126 // array, in |packet_list|. Returns false if |packet_list| already was empty, | 126 // array, in |packet_list|. Returns false if |packet_list| already was empty, |
| 127 // otherwise true. | 127 // otherwise true. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 146 } | 146 } |
| 147 | 147 |
| 148 private: | 148 private: |
| 149 size_t max_number_of_packets_; | 149 size_t max_number_of_packets_; |
| 150 PacketList buffer_; | 150 PacketList buffer_; |
| 151 DISALLOW_COPY_AND_ASSIGN(PacketBuffer); | 151 DISALLOW_COPY_AND_ASSIGN(PacketBuffer); |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace webrtc | 154 } // namespace webrtc |
| 155 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ | 155 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ |
| OLD | NEW |