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_INCLUDE_NETEQ_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_NETEQ_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_NETEQ_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_NETEQ_H_ |
13 | 13 |
14 #include <string.h> // Provide access to size_t. | 14 #include <string.h> // Provide access to size_t. |
15 | 15 |
16 #include <string> | 16 #include <string> |
17 | 17 |
18 #include "webrtc/base/constructormagic.h" | 18 #include "webrtc/base/constructormagic.h" |
19 #include "webrtc/base/optional.h" | 19 #include "webrtc/base/optional.h" |
20 #include "webrtc/base/scoped_ref_ptr.h" | 20 #include "webrtc/base/scoped_ref_ptr.h" |
21 #include "webrtc/common_types.h" | 21 #include "webrtc/common_types.h" |
22 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" | 22 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" |
23 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
24 | 24 |
25 namespace webrtc { | 25 namespace webrtc { |
26 | 26 |
27 // Forward declarations. | 27 // Forward declarations. |
28 class AudioFrame; | 28 class AudioFrame; |
29 struct WebRtcRTPHeader; | |
30 class AudioDecoderFactory; | 29 class AudioDecoderFactory; |
31 | 30 |
32 struct NetEqNetworkStatistics { | 31 struct NetEqNetworkStatistics { |
33 uint16_t current_buffer_size_ms; // Current jitter buffer size in ms. | 32 uint16_t current_buffer_size_ms; // Current jitter buffer size in ms. |
34 uint16_t preferred_buffer_size_ms; // Target buffer size in ms. | 33 uint16_t preferred_buffer_size_ms; // Target buffer size in ms. |
35 uint16_t jitter_peaks_found; // 1 if adding extra delay due to peaky | 34 uint16_t jitter_peaks_found; // 1 if adding extra delay due to peaky |
36 // jitter; 0 otherwise. | 35 // jitter; 0 otherwise. |
37 uint16_t packet_loss_rate; // Loss rate (network + late) in Q14. | 36 uint16_t packet_loss_rate; // Loss rate (network + late) in Q14. |
38 uint16_t packet_discard_rate; // Late loss rate in Q14. | 37 uint16_t packet_discard_rate; // Late loss rate in Q14. |
39 uint16_t expand_rate; // Fraction (of original stream) of synthesized | 38 uint16_t expand_rate; // Fraction (of original stream) of synthesized |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 static NetEq* Create( | 133 static NetEq* Create( |
135 const NetEq::Config& config, | 134 const NetEq::Config& config, |
136 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory); | 135 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory); |
137 | 136 |
138 virtual ~NetEq() {} | 137 virtual ~NetEq() {} |
139 | 138 |
140 // Inserts a new packet into NetEq. The |receive_timestamp| is an indication | 139 // Inserts a new packet into NetEq. The |receive_timestamp| is an indication |
141 // of the time when the packet was received, and should be measured with | 140 // of the time when the packet was received, and should be measured with |
142 // the same tick rate as the RTP timestamp of the current payload. | 141 // the same tick rate as the RTP timestamp of the current payload. |
143 // Returns 0 on success, -1 on failure. | 142 // Returns 0 on success, -1 on failure. |
144 virtual int InsertPacket(const WebRtcRTPHeader& rtp_header, | 143 virtual int InsertPacket(const RTPHeader& rtp_header, |
145 rtc::ArrayView<const uint8_t> payload, | 144 rtc::ArrayView<const uint8_t> payload, |
146 uint32_t receive_timestamp) = 0; | 145 uint32_t receive_timestamp) = 0; |
147 | 146 |
148 // Instructs NetEq to deliver 10 ms of audio data. The data is written to | 147 // Instructs NetEq to deliver 10 ms of audio data. The data is written to |
149 // |audio_frame|. All data in |audio_frame| is wiped; |data_|, |speech_type_|, | 148 // |audio_frame|. All data in |audio_frame| is wiped; |data_|, |speech_type_|, |
150 // |num_channels_|, |sample_rate_hz_|, |samples_per_channel_|, and | 149 // |num_channels_|, |sample_rate_hz_|, |samples_per_channel_|, and |
151 // |vad_activity_| are updated upon success. If an error is returned, some | 150 // |vad_activity_| are updated upon success. If an error is returned, some |
152 // fields may not have been updated, or may contain inconsistent values. | 151 // fields may not have been updated, or may contain inconsistent values. |
153 // If muted state is enabled (through Config::enable_muted_state), |muted| | 152 // If muted state is enabled (through Config::enable_muted_state), |muted| |
154 // may be set to true after a prolonged expand period. When this happens, the | 153 // may be set to true after a prolonged expand period. When this happens, the |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 304 |
306 protected: | 305 protected: |
307 NetEq() {} | 306 NetEq() {} |
308 | 307 |
309 private: | 308 private: |
310 RTC_DISALLOW_COPY_AND_ASSIGN(NetEq); | 309 RTC_DISALLOW_COPY_AND_ASSIGN(NetEq); |
311 }; | 310 }; |
312 | 311 |
313 } // namespace webrtc | 312 } // namespace webrtc |
314 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_NETEQ_H_ | 313 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_INCLUDE_NETEQ_H_ |
OLD | NEW |