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 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 int SetMaximumDelay(int delay_ms); | 144 int SetMaximumDelay(int delay_ms); |
145 | 145 |
146 // | 146 // |
147 // Get least required delay computed based on channel conditions. Note that | 147 // Get least required delay computed based on channel conditions. Note that |
148 // this is before applying any user-defined limits (specified by calling | 148 // this is before applying any user-defined limits (specified by calling |
149 // (SetMinimumDelay() and/or SetMaximumDelay()). | 149 // (SetMinimumDelay() and/or SetMaximumDelay()). |
150 // | 150 // |
151 int LeastRequiredDelayMs() const; | 151 int LeastRequiredDelayMs() const; |
152 | 152 |
153 // | 153 // |
154 // Sets an initial delay of |delay_ms| milliseconds. This introduces a playout | |
155 // delay. Silence (zero signal) is played out until equivalent of |delay_ms| | |
156 // millisecond of audio is buffered. Then, NetEq maintains the delay. | |
157 // | |
158 // Input: | |
159 // - delay_ms : initial delay in milliseconds. | |
160 // | |
161 // Return value : 0 if OK. | |
162 // <0 if NetEq returned an error. | |
163 // | |
164 int SetInitialDelay(int delay_ms); | |
165 | |
166 // | |
167 // Resets the initial delay to zero. | 154 // Resets the initial delay to zero. |
168 // | 155 // |
169 void ResetInitialDelay(); | 156 void ResetInitialDelay(); |
170 | 157 |
171 // | 158 // |
172 // Get the current sampling frequency in Hz. | 159 // Get the current sampling frequency in Hz. |
173 // | 160 // |
174 // Return value : Sampling frequency in Hz. | 161 // Return value : Sampling frequency in Hz. |
175 // | 162 // |
176 int current_sample_rate_hz() const; | 163 int current_sample_rate_hz() const; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 // -round_trip_time_ms : estimate of the round-trip-time (in milliseconds). | 271 // -round_trip_time_ms : estimate of the round-trip-time (in milliseconds). |
285 // Return value : list of packets to be retransmitted. | 272 // Return value : list of packets to be retransmitted. |
286 // | 273 // |
287 std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const; | 274 std::vector<uint16_t> GetNackList(int64_t round_trip_time_ms) const; |
288 | 275 |
289 // | 276 // |
290 // Get statistics of calls to GetAudio(). | 277 // Get statistics of calls to GetAudio(). |
291 void GetDecodingCallStatistics(AudioDecodingCallStats* stats) const; | 278 void GetDecodingCallStatistics(AudioDecodingCallStats* stats) const; |
292 | 279 |
293 private: | 280 private: |
294 bool GetSilence(int desired_sample_rate_hz, AudioFrame* frame) | |
295 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | |
296 | |
297 int GetNumSyncPacketToInsert(uint16_t received_squence_number); | |
298 | |
299 const Decoder* RtpHeaderToDecoder(const RTPHeader& rtp_header, | 281 const Decoder* RtpHeaderToDecoder(const RTPHeader& rtp_header, |
300 const uint8_t* payload) const | 282 const uint8_t* payload) const |
301 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); | 283 EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); |
302 | 284 |
303 uint32_t NowInTimestamp(int decoder_sampling_rate) const; | 285 uint32_t NowInTimestamp(int decoder_sampling_rate) const; |
304 | 286 |
305 void InsertStreamOfSyncPackets(InitialDelayManager::SyncStream* sync_stream); | |
kwiberg-webrtc
2015/11/02 14:45:49
I presume InsertStreamOfConsciousness() was alread
hlundin-webrtc
2015/11/02 15:31:54
Yes, together with MuteInnerVoices().
| |
306 | |
307 rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_; | 287 rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_; |
308 int id_; // TODO(henrik.lundin) Make const. | 288 int id_; // TODO(henrik.lundin) Make const. |
309 const Decoder* last_audio_decoder_ GUARDED_BY(crit_sect_); | 289 const Decoder* last_audio_decoder_ GUARDED_BY(crit_sect_); |
310 AudioFrame::VADActivity previous_audio_activity_ GUARDED_BY(crit_sect_); | 290 AudioFrame::VADActivity previous_audio_activity_ GUARDED_BY(crit_sect_); |
311 int current_sample_rate_hz_ GUARDED_BY(crit_sect_); | 291 int current_sample_rate_hz_ GUARDED_BY(crit_sect_); |
312 ACMResampler resampler_ GUARDED_BY(crit_sect_); | 292 ACMResampler resampler_ GUARDED_BY(crit_sect_); |
313 // Used in GetAudio, declared as member to avoid allocating every 10ms. | 293 // Used in GetAudio, declared as member to avoid allocating every 10ms. |
314 // TODO(henrik.lundin) Stack-allocate in GetAudio instead? | 294 // TODO(henrik.lundin) Stack-allocate in GetAudio instead? |
315 rtc::scoped_ptr<int16_t[]> audio_buffer_ GUARDED_BY(crit_sect_); | 295 rtc::scoped_ptr<int16_t[]> audio_buffer_ GUARDED_BY(crit_sect_); |
316 rtc::scoped_ptr<int16_t[]> last_audio_buffer_ GUARDED_BY(crit_sect_); | 296 rtc::scoped_ptr<int16_t[]> last_audio_buffer_ GUARDED_BY(crit_sect_); |
317 CallStatistics call_stats_ GUARDED_BY(crit_sect_); | 297 CallStatistics call_stats_ GUARDED_BY(crit_sect_); |
318 NetEq* neteq_; | 298 NetEq* neteq_; |
319 // Decoders map is keyed by payload type | 299 // Decoders map is keyed by payload type |
320 std::map<uint8_t, Decoder> decoders_ GUARDED_BY(crit_sect_); | 300 std::map<uint8_t, Decoder> decoders_ GUARDED_BY(crit_sect_); |
321 bool vad_enabled_; | 301 bool vad_enabled_; |
322 Clock* clock_; // TODO(henrik.lundin) Make const if possible. | 302 Clock* clock_; // TODO(henrik.lundin) Make const if possible. |
323 bool resampled_last_output_frame_ GUARDED_BY(crit_sect_); | 303 bool resampled_last_output_frame_ GUARDED_BY(crit_sect_); |
324 | |
325 // Indicates if a non-zero initial delay is set, and the receiver is in | |
326 // AV-sync mode. | |
327 bool av_sync_; | |
328 rtc::scoped_ptr<InitialDelayManager> initial_delay_manager_; | |
329 | |
330 // The following are defined as members to avoid creating them in every | |
331 // iteration. |missing_packets_sync_stream_| is *ONLY* used in InsertPacket(). | |
332 // |late_packets_sync_stream_| is only used in GetAudio(). Both of these | |
333 // member variables are allocated only when we AV-sync is enabled, i.e. | |
334 // initial delay is set. | |
335 rtc::scoped_ptr<InitialDelayManager::SyncStream> missing_packets_sync_stream_; | |
336 rtc::scoped_ptr<InitialDelayManager::SyncStream> late_packets_sync_stream_; | |
337 }; | 304 }; |
338 | 305 |
339 } // namespace acm2 | 306 } // namespace acm2 |
340 | 307 |
341 } // namespace webrtc | 308 } // namespace webrtc |
342 | 309 |
343 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVER_H_ | 310 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_RECEIVER_H_ |
OLD | NEW |