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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // losses when Video NACK is enabled but Audio NACK is not. Clients of NetEq | 89 // losses when Video NACK is enabled but Audio NACK is not. Clients of NetEq |
90 // might insert sync-packet when they observe that buffer level of NetEq is | 90 // might insert sync-packet when they observe that buffer level of NetEq is |
91 // decreasing below a certain threshold, defined by the application. | 91 // decreasing below a certain threshold, defined by the application. |
92 // Sync-packets should have the same payload type as the last audio payload | 92 // Sync-packets should have the same payload type as the last audio payload |
93 // type, i.e. they cannot have DTMF or CNG payload type, nor a codec change | 93 // type, i.e. they cannot have DTMF or CNG payload type, nor a codec change |
94 // can be implied by inserting a sync-packet. | 94 // can be implied by inserting a sync-packet. |
95 // Returns kOk on success, kFail on failure. | 95 // Returns kOk on success, kFail on failure. |
96 int InsertSyncPacket(const WebRtcRTPHeader& rtp_header, | 96 int InsertSyncPacket(const WebRtcRTPHeader& rtp_header, |
97 uint32_t receive_timestamp) override; | 97 uint32_t receive_timestamp) override; |
98 | 98 |
99 // Instructs NetEq to deliver 10 ms of audio data. The data is written to | 99 int GetAudio(AudioFrame* audio_frame, NetEqOutputType* type) override; |
100 // |output_audio|, which can hold (at least) |max_length| elements. | |
101 // The number of channels that were written to the output is provided in | |
102 // the output variable |num_channels|, and each channel contains | |
103 // |samples_per_channel| elements. If more than one channel is written, | |
104 // the samples are interleaved. | |
105 // The speech type is written to |type|, if |type| is not NULL. | |
106 // Returns kOK on success, or kFail in case of an error. | |
107 int GetAudio(size_t max_length, | |
108 int16_t* output_audio, | |
109 size_t* samples_per_channel, | |
110 size_t* num_channels, | |
111 NetEqOutputType* type) override; | |
112 | 100 |
113 int RegisterPayloadType(NetEqDecoder codec, | 101 int RegisterPayloadType(NetEqDecoder codec, |
114 const std::string& codec_name, | 102 const std::string& codec_name, |
115 uint8_t rtp_payload_type) override; | 103 uint8_t rtp_payload_type) override; |
116 | 104 |
117 int RegisterExternalDecoder(AudioDecoder* decoder, | 105 int RegisterExternalDecoder(AudioDecoder* decoder, |
118 NetEqDecoder codec, | 106 NetEqDecoder codec, |
119 const std::string& codec_name, | 107 const std::string& codec_name, |
120 uint8_t rtp_payload_type, | 108 uint8_t rtp_payload_type, |
121 int sample_rate_hz) override; | 109 int sample_rate_hz) override; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 192 |
205 // Inserts a new packet into NetEq. This is used by the InsertPacket method | 193 // Inserts a new packet into NetEq. This is used by the InsertPacket method |
206 // above. Returns 0 on success, otherwise an error code. | 194 // above. Returns 0 on success, otherwise an error code. |
207 // TODO(hlundin): Merge this with InsertPacket above? | 195 // TODO(hlundin): Merge this with InsertPacket above? |
208 int InsertPacketInternal(const WebRtcRTPHeader& rtp_header, | 196 int InsertPacketInternal(const WebRtcRTPHeader& rtp_header, |
209 rtc::ArrayView<const uint8_t> payload, | 197 rtc::ArrayView<const uint8_t> payload, |
210 uint32_t receive_timestamp, | 198 uint32_t receive_timestamp, |
211 bool is_sync_packet) | 199 bool is_sync_packet) |
212 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 200 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
213 | 201 |
214 // Delivers 10 ms of audio data. The data is written to |output|, which can | 202 // Delivers 10 ms of audio data. The data is written to |audio_frame|. |
215 // hold (at least) |max_length| elements. The number of channels that were | |
216 // written to the output is provided in the output variable |num_channels|, | |
217 // and each channel contains |samples_per_channel| elements. If more than one | |
218 // channel is written, the samples are interleaved. | |
219 // Returns 0 on success, otherwise an error code. | 203 // Returns 0 on success, otherwise an error code. |
220 int GetAudioInternal(size_t max_length, | 204 int GetAudioInternal(AudioFrame* audio_frame) |
221 int16_t* output, | |
222 size_t* samples_per_channel, | |
223 size_t* num_channels) | |
224 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 205 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
225 | 206 |
226 // Provides a decision to the GetAudioInternal method. The decision what to | 207 // Provides a decision to the GetAudioInternal method. The decision what to |
227 // do is written to |operation|. Packets to decode are written to | 208 // do is written to |operation|. Packets to decode are written to |
228 // |packet_list|, and a DTMF event to play is written to |dtmf_event|. When | 209 // |packet_list|, and a DTMF event to play is written to |dtmf_event|. When |
229 // DTMF should be played, |play_dtmf| is set to true by the method. | 210 // DTMF should be played, |play_dtmf| is set to true by the method. |
230 // Returns 0 on success, otherwise an error code. | 211 // Returns 0 on success, otherwise an error code. |
231 int GetDecision(Operations* operation, | 212 int GetDecision(Operations* operation, |
232 PacketList* packet_list, | 213 PacketList* packet_list, |
233 DtmfEvent* dtmf_event, | 214 DtmfEvent* dtmf_event, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 bool enable_fast_accelerate_ GUARDED_BY(crit_sect_); | 379 bool enable_fast_accelerate_ GUARDED_BY(crit_sect_); |
399 std::unique_ptr<Nack> nack_ GUARDED_BY(crit_sect_); | 380 std::unique_ptr<Nack> nack_ GUARDED_BY(crit_sect_); |
400 bool nack_enabled_ GUARDED_BY(crit_sect_); | 381 bool nack_enabled_ GUARDED_BY(crit_sect_); |
401 | 382 |
402 private: | 383 private: |
403 RTC_DISALLOW_COPY_AND_ASSIGN(NetEqImpl); | 384 RTC_DISALLOW_COPY_AND_ASSIGN(NetEqImpl); |
404 }; | 385 }; |
405 | 386 |
406 } // namespace webrtc | 387 } // namespace webrtc |
407 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ | 388 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ |
OLD | NEW |