OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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_MAIN_ACM2_ACM_RECEIVER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVER_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVER_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVER_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/array_view.h" | 17 #include "webrtc/base/array_view.h" |
| 18 #include "webrtc/base/optional.h" |
18 #include "webrtc/base/scoped_ptr.h" | 19 #include "webrtc/base/scoped_ptr.h" |
19 #include "webrtc/base/thread_annotations.h" | 20 #include "webrtc/base/thread_annotations.h" |
20 #include "webrtc/common_audio/vad/include/webrtc_vad.h" | 21 #include "webrtc/common_audio/vad/include/webrtc_vad.h" |
21 #include "webrtc/engine_configurations.h" | 22 #include "webrtc/engine_configurations.h" |
22 #include "webrtc/modules/audio_coding/main/include/audio_coding_module.h" | 23 #include "webrtc/modules/audio_coding/main/include/audio_coding_module.h" |
23 #include "webrtc/modules/audio_coding/main/acm2/acm_resampler.h" | 24 #include "webrtc/modules/audio_coding/main/acm2/acm_resampler.h" |
24 #include "webrtc/modules/audio_coding/main/acm2/call_statistics.h" | 25 #include "webrtc/modules/audio_coding/main/acm2/call_statistics.h" |
25 #include "webrtc/modules/audio_coding/main/acm2/initial_delay_manager.h" | 26 #include "webrtc/modules/audio_coding/main/acm2/initial_delay_manager.h" |
26 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" | 27 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" |
27 #include "webrtc/modules/include/module_common_types.h" | 28 #include "webrtc/modules/include/module_common_types.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // this is before applying any user-defined limits (specified by calling | 148 // this is before applying any user-defined limits (specified by calling |
148 // (SetMinimumDelay() and/or SetMaximumDelay()). | 149 // (SetMinimumDelay() and/or SetMaximumDelay()). |
149 // | 150 // |
150 int LeastRequiredDelayMs() const; | 151 int LeastRequiredDelayMs() const; |
151 | 152 |
152 // | 153 // |
153 // Resets the initial delay to zero. | 154 // Resets the initial delay to zero. |
154 // | 155 // |
155 void ResetInitialDelay(); | 156 void ResetInitialDelay(); |
156 | 157 |
| 158 // Returns the sample rate of the decoder associated with the last incoming |
| 159 // packet. If no packet of a registered non-CNG codec has been received, the |
| 160 // return value is empty. Also, if the decoder was unregistered since the last |
| 161 // packet was inserted, the return value is empty. |
| 162 rtc::Optional<int> last_packet_sample_rate_hz() const; |
| 163 |
157 // Returns last_output_sample_rate_hz from the NetEq instance. | 164 // Returns last_output_sample_rate_hz from the NetEq instance. |
158 int last_output_sample_rate_hz() const; | 165 int last_output_sample_rate_hz() const; |
159 | 166 |
160 // | 167 // |
161 // Get the current network statistics from NetEq. | 168 // Get the current network statistics from NetEq. |
162 // | 169 // |
163 // Output: | 170 // Output: |
164 // - statistics : The current network statistics. | 171 // - statistics : The current network statistics. |
165 // | 172 // |
166 void GetNetworkStatistics(NetworkStatistics* statistics); | 173 void GetNetworkStatistics(NetworkStatistics* statistics); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 // | 213 // |
207 void set_id(int id); // TODO(turajs): can be inline. | 214 void set_id(int id); // TODO(turajs): can be inline. |
208 | 215 |
209 // | 216 // |
210 // Gets the RTP timestamp of the last sample delivered by GetAudio(). | 217 // Gets the RTP timestamp of the last sample delivered by GetAudio(). |
211 // Returns true if the RTP timestamp is valid, otherwise false. | 218 // Returns true if the RTP timestamp is valid, otherwise false. |
212 // | 219 // |
213 bool GetPlayoutTimestamp(uint32_t* timestamp); | 220 bool GetPlayoutTimestamp(uint32_t* timestamp); |
214 | 221 |
215 // | 222 // |
216 // Return the index of the codec associated with the last non-CNG/non-DTMF | |
217 // received payload. If no non-CNG/non-DTMF payload is received -1 is | |
218 // returned. | |
219 // | |
220 int last_audio_codec_id() const; // TODO(turajs): can be inline. | |
221 | |
222 // | |
223 // Get the audio codec associated with the last non-CNG/non-DTMF received | 223 // Get the audio codec associated with the last non-CNG/non-DTMF received |
224 // payload. If no non-CNG/non-DTMF packet is received -1 is returned, | 224 // payload. If no non-CNG/non-DTMF packet is received -1 is returned, |
225 // otherwise return 0. | 225 // otherwise return 0. |
226 // | 226 // |
227 int LastAudioCodec(CodecInst* codec) const; | 227 int LastAudioCodec(CodecInst* codec) const; |
228 | 228 |
229 // | 229 // |
230 // Get a decoder given its registered payload-type. | 230 // Get a decoder given its registered payload-type. |
231 // | 231 // |
232 // Input: | 232 // Input: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // TODO(henrik.lundin) Stack-allocate in GetAudio instead? | 288 // TODO(henrik.lundin) Stack-allocate in GetAudio instead? |
289 rtc::scoped_ptr<int16_t[]> audio_buffer_ GUARDED_BY(crit_sect_); | 289 rtc::scoped_ptr<int16_t[]> audio_buffer_ GUARDED_BY(crit_sect_); |
290 rtc::scoped_ptr<int16_t[]> last_audio_buffer_ GUARDED_BY(crit_sect_); | 290 rtc::scoped_ptr<int16_t[]> last_audio_buffer_ GUARDED_BY(crit_sect_); |
291 CallStatistics call_stats_ GUARDED_BY(crit_sect_); | 291 CallStatistics call_stats_ GUARDED_BY(crit_sect_); |
292 NetEq* neteq_; | 292 NetEq* neteq_; |
293 // Decoders map is keyed by payload type | 293 // Decoders map is keyed by payload type |
294 std::map<uint8_t, Decoder> decoders_ GUARDED_BY(crit_sect_); | 294 std::map<uint8_t, Decoder> decoders_ GUARDED_BY(crit_sect_); |
295 bool vad_enabled_; | 295 bool vad_enabled_; |
296 Clock* clock_; // TODO(henrik.lundin) Make const if possible. | 296 Clock* clock_; // TODO(henrik.lundin) Make const if possible. |
297 bool resampled_last_output_frame_ GUARDED_BY(crit_sect_); | 297 bool resampled_last_output_frame_ GUARDED_BY(crit_sect_); |
| 298 rtc::Optional<int> last_packet_sample_rate_hz_ GUARDED_BY(crit_sect_); |
298 }; | 299 }; |
299 | 300 |
300 } // namespace acm2 | 301 } // namespace acm2 |
301 | 302 |
302 } // namespace webrtc | 303 } // namespace webrtc |
303 | 304 |
304 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVER_H_ | 305 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVER_H_ |
OLD | NEW |