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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 PreemptiveExpandFactory* preemptive_expand_factory, | 72 PreemptiveExpandFactory* preemptive_expand_factory, |
73 bool create_components = true); | 73 bool create_components = true); |
74 | 74 |
75 ~NetEqImpl() override; | 75 ~NetEqImpl() override; |
76 | 76 |
77 // Inserts a new packet into NetEq. The |receive_timestamp| is an indication | 77 // Inserts a new packet into NetEq. The |receive_timestamp| is an indication |
78 // of the time when the packet was received, and should be measured with | 78 // of the time when the packet was received, and should be measured with |
79 // the same tick rate as the RTP timestamp of the current payload. | 79 // the same tick rate as the RTP timestamp of the current payload. |
80 // Returns 0 on success, -1 on failure. | 80 // Returns 0 on success, -1 on failure. |
81 int InsertPacket(const WebRtcRTPHeader& rtp_header, | 81 int InsertPacket(const WebRtcRTPHeader& rtp_header, |
82 const uint8_t* payload, | 82 rtc::ArrayView<const uint8_t> payload, |
83 size_t length_bytes, | |
84 uint32_t receive_timestamp) override; | 83 uint32_t receive_timestamp) override; |
85 | 84 |
86 // Inserts a sync-packet into packet queue. Sync-packets are decoded to | 85 // Inserts a sync-packet into packet queue. Sync-packets are decoded to |
87 // silence and are intended to keep AV-sync intact in an event of long packet | 86 // silence and are intended to keep AV-sync intact in an event of long packet |
88 // losses when Video NACK is enabled but Audio NACK is not. Clients of NetEq | 87 // losses when Video NACK is enabled but Audio NACK is not. Clients of NetEq |
89 // might insert sync-packet when they observe that buffer level of NetEq is | 88 // might insert sync-packet when they observe that buffer level of NetEq is |
90 // decreasing below a certain threshold, defined by the application. | 89 // decreasing below a certain threshold, defined by the application. |
91 // Sync-packets should have the same payload type as the last audio payload | 90 // Sync-packets should have the same payload type as the last audio payload |
92 // type, i.e. they cannot have DTMF or CNG payload type, nor a codec change | 91 // type, i.e. they cannot have DTMF or CNG payload type, nor a codec change |
93 // can be implied by inserting a sync-packet. | 92 // can be implied by inserting a sync-packet. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 protected: | 199 protected: |
201 static const int kOutputSizeMs = 10; | 200 static const int kOutputSizeMs = 10; |
202 static const size_t kMaxFrameSize = 2880; // 60 ms @ 48 kHz. | 201 static const size_t kMaxFrameSize = 2880; // 60 ms @ 48 kHz. |
203 // TODO(hlundin): Provide a better value for kSyncBufferSize. | 202 // TODO(hlundin): Provide a better value for kSyncBufferSize. |
204 static const size_t kSyncBufferSize = 2 * kMaxFrameSize; | 203 static const size_t kSyncBufferSize = 2 * kMaxFrameSize; |
205 | 204 |
206 // Inserts a new packet into NetEq. This is used by the InsertPacket method | 205 // Inserts a new packet into NetEq. This is used by the InsertPacket method |
207 // above. Returns 0 on success, otherwise an error code. | 206 // above. Returns 0 on success, otherwise an error code. |
208 // TODO(hlundin): Merge this with InsertPacket above? | 207 // TODO(hlundin): Merge this with InsertPacket above? |
209 int InsertPacketInternal(const WebRtcRTPHeader& rtp_header, | 208 int InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
210 const uint8_t* payload, | 209 rtc::ArrayView<const uint8_t> payload, |
211 size_t length_bytes, | |
212 uint32_t receive_timestamp, | 210 uint32_t receive_timestamp, |
213 bool is_sync_packet) | 211 bool is_sync_packet) |
214 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 212 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
215 | 213 |
216 // Delivers 10 ms of audio data. The data is written to |output|, which can | 214 // Delivers 10 ms of audio data. The data is written to |output|, which can |
217 // hold (at least) |max_length| elements. The number of channels that were | 215 // hold (at least) |max_length| elements. The number of channels that were |
218 // written to the output is provided in the output variable |num_channels|, | 216 // written to the output is provided in the output variable |num_channels|, |
219 // and each channel contains |samples_per_channel| elements. If more than one | 217 // and each channel contains |samples_per_channel| elements. If more than one |
220 // channel is written, the samples are interleaved. | 218 // channel is written, the samples are interleaved. |
221 // Returns 0 on success, otherwise an error code. | 219 // Returns 0 on success, otherwise an error code. |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 bool enable_fast_accelerate_ GUARDED_BY(crit_sect_); | 396 bool enable_fast_accelerate_ GUARDED_BY(crit_sect_); |
399 rtc::scoped_ptr<Nack> nack_ GUARDED_BY(crit_sect_); | 397 rtc::scoped_ptr<Nack> nack_ GUARDED_BY(crit_sect_); |
400 bool nack_enabled_ GUARDED_BY(crit_sect_); | 398 bool nack_enabled_ GUARDED_BY(crit_sect_); |
401 | 399 |
402 private: | 400 private: |
403 RTC_DISALLOW_COPY_AND_ASSIGN(NetEqImpl); | 401 RTC_DISALLOW_COPY_AND_ASSIGN(NetEqImpl); |
404 }; | 402 }; |
405 | 403 |
406 } // namespace webrtc | 404 } // namespace webrtc |
407 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ | 405 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ |
OLD | NEW |