| 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 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ |
| 13 | 13 |
| 14 #include "webrtc/base/constructormagic.h" | 14 #include "webrtc/base/constructormagic.h" |
| 15 #include "webrtc/base/optional.h" |
| 15 #include "webrtc/modules/audio_coding/neteq/packet.h" | 16 #include "webrtc/modules/audio_coding/neteq/packet.h" |
| 16 #include "webrtc/typedefs.h" | 17 #include "webrtc/typedefs.h" |
| 17 | 18 |
| 18 namespace webrtc { | 19 namespace webrtc { |
| 19 | 20 |
| 20 class DecoderDatabase; | 21 class DecoderDatabase; |
| 21 class TickTimer; | 22 class TickTimer; |
| 22 | 23 |
| 23 // This is the actual buffer holding the packets before decoding. | 24 // This is the actual buffer holding the packets before decoding. |
| 24 class PacketBuffer { | 25 class PacketBuffer { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 52 virtual int InsertPacket(Packet* packet); | 53 virtual int InsertPacket(Packet* packet); |
| 53 | 54 |
| 54 // Inserts a list of packets into the buffer. The buffer will take over | 55 // Inserts a list of packets into the buffer. The buffer will take over |
| 55 // ownership of the packet objects. | 56 // ownership of the packet objects. |
| 56 // Returns PacketBuffer::kOK if all packets were inserted successfully. | 57 // Returns PacketBuffer::kOK if all packets were inserted successfully. |
| 57 // If the buffer was flushed due to overfilling, only a subset of the list is | 58 // If the buffer was flushed due to overfilling, only a subset of the list is |
| 58 // inserted, and PacketBuffer::kFlushed is returned. | 59 // inserted, and PacketBuffer::kFlushed is returned. |
| 59 // The last three parameters are included for legacy compatibility. | 60 // The last three parameters are included for legacy compatibility. |
| 60 // TODO(hlundin): Redesign to not use current_*_payload_type and | 61 // TODO(hlundin): Redesign to not use current_*_payload_type and |
| 61 // decoder_database. | 62 // decoder_database. |
| 62 virtual int InsertPacketList(PacketList* packet_list, | 63 virtual int InsertPacketList( |
| 63 const DecoderDatabase& decoder_database, | 64 PacketList* packet_list, |
| 64 uint8_t* current_rtp_payload_type, | 65 const DecoderDatabase& decoder_database, |
| 65 uint8_t* current_cng_rtp_payload_type); | 66 rtc::Optional<uint8_t>* current_rtp_payload_type, |
| 67 rtc::Optional<uint8_t>* current_cng_rtp_payload_type); |
| 66 | 68 |
| 67 // Gets the timestamp for the first packet in the buffer and writes it to the | 69 // Gets the timestamp for the first packet in the buffer and writes it to the |
| 68 // output variable |next_timestamp|. | 70 // output variable |next_timestamp|. |
| 69 // Returns PacketBuffer::kBufferEmpty if the buffer is empty, | 71 // Returns PacketBuffer::kBufferEmpty if the buffer is empty, |
| 70 // PacketBuffer::kOK otherwise. | 72 // PacketBuffer::kOK otherwise. |
| 71 virtual int NextTimestamp(uint32_t* next_timestamp) const; | 73 virtual int NextTimestamp(uint32_t* next_timestamp) const; |
| 72 | 74 |
| 73 // Gets the timestamp for the first packet in the buffer with a timestamp no | 75 // Gets the timestamp for the first packet in the buffer with a timestamp no |
| 74 // lower than the input limit |timestamp|. The result is written to the output | 76 // lower than the input limit |timestamp|. The result is written to the output |
| 75 // variable |next_timestamp|. | 77 // variable |next_timestamp|. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 145 |
| 144 private: | 146 private: |
| 145 size_t max_number_of_packets_; | 147 size_t max_number_of_packets_; |
| 146 PacketList buffer_; | 148 PacketList buffer_; |
| 147 const TickTimer* tick_timer_; | 149 const TickTimer* tick_timer_; |
| 148 RTC_DISALLOW_COPY_AND_ASSIGN(PacketBuffer); | 150 RTC_DISALLOW_COPY_AND_ASSIGN(PacketBuffer); |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 } // namespace webrtc | 153 } // namespace webrtc |
| 152 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ | 154 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_PACKET_BUFFER_H_ |
| OLD | NEW |