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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 namespace acm2 { | 30 namespace acm2 { |
31 | 31 |
32 class ACMDTMFDetection; | 32 class ACMDTMFDetection; |
33 | 33 |
34 class AudioCodingModuleImpl final : public AudioCodingModule { | 34 class AudioCodingModuleImpl final : public AudioCodingModule { |
35 public: | 35 public: |
36 friend webrtc::AudioCodingImpl; | 36 friend webrtc::AudioCodingImpl; |
37 | 37 |
38 explicit AudioCodingModuleImpl(const AudioCodingModule::Config& config); | 38 explicit AudioCodingModuleImpl(const AudioCodingModule::Config& config); |
39 ~AudioCodingModuleImpl() override; | |
40 | 39 |
41 ///////////////////////////////////////// | 40 ///////////////////////////////////////// |
42 // Sender | 41 // Sender |
43 // | 42 // |
44 | 43 |
45 // Can be called multiple times for Codec, CNG, RED. | 44 // Can be called multiple times for Codec, CNG, RED. |
46 int RegisterSendCodec(const CodecInst& send_codec) override; | 45 int RegisterSendCodec(const CodecInst& send_codec) override; |
47 | 46 |
48 void RegisterExternalSendCodec( | 47 void RegisterExternalSendCodec( |
49 AudioEncoderMutable* external_speech_encoder) override; | 48 AudioEncoderMutable* external_speech_encoder) override; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // -1: if encountering an error. | 256 // -1: if encountering an error. |
258 // 0: otherwise. | 257 // 0: otherwise. |
259 int PreprocessToAddData(const AudioFrame& in_frame, | 258 int PreprocessToAddData(const AudioFrame& in_frame, |
260 const AudioFrame** ptr_out) | 259 const AudioFrame** ptr_out) |
261 EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_); | 260 EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_); |
262 | 261 |
263 // Change required states after starting to receive the codec corresponding | 262 // Change required states after starting to receive the codec corresponding |
264 // to |index|. | 263 // to |index|. |
265 int UpdateUponReceivingCodec(int index); | 264 int UpdateUponReceivingCodec(int index); |
266 | 265 |
267 CriticalSectionWrapper* acm_crit_sect_; | 266 const rtc::scoped_ptr<CriticalSectionWrapper> acm_crit_sect_; |
268 int id_; // TODO(henrik.lundin) Make const. | 267 int id_; // TODO(henrik.lundin) Make const. |
269 uint32_t expected_codec_ts_ GUARDED_BY(acm_crit_sect_); | 268 uint32_t expected_codec_ts_ GUARDED_BY(acm_crit_sect_); |
270 uint32_t expected_in_ts_ GUARDED_BY(acm_crit_sect_); | 269 uint32_t expected_in_ts_ GUARDED_BY(acm_crit_sect_); |
271 ACMResampler resampler_ GUARDED_BY(acm_crit_sect_); | 270 ACMResampler resampler_ GUARDED_BY(acm_crit_sect_); |
272 AcmReceiver receiver_; // AcmReceiver has it's own internal lock. | 271 AcmReceiver receiver_; // AcmReceiver has it's own internal lock. |
273 ChangeLogger bitrate_logger_ GUARDED_BY(acm_crit_sect_); | 272 ChangeLogger bitrate_logger_ GUARDED_BY(acm_crit_sect_); |
274 CodecManager codec_manager_ GUARDED_BY(acm_crit_sect_); | 273 CodecManager codec_manager_ GUARDED_BY(acm_crit_sect_); |
275 | 274 |
276 // This is to keep track of CN instances where we can send DTMFs. | 275 // This is to keep track of CN instances where we can send DTMFs. |
277 uint8_t previous_pltype_ GUARDED_BY(acm_crit_sect_); | 276 uint8_t previous_pltype_ GUARDED_BY(acm_crit_sect_); |
278 | 277 |
279 // Used when payloads are pushed into ACM without any RTP info | 278 // Used when payloads are pushed into ACM without any RTP info |
280 // One example is when pre-encoded bit-stream is pushed from | 279 // One example is when pre-encoded bit-stream is pushed from |
281 // a file. | 280 // a file. |
282 // IMPORTANT: this variable is only used in IncomingPayload(), therefore, | 281 // IMPORTANT: this variable is only used in IncomingPayload(), therefore, |
283 // no lock acquired when interacting with this variable. If it is going to | 282 // no lock acquired when interacting with this variable. If it is going to |
284 // be used in other methods, locks need to be taken. | 283 // be used in other methods, locks need to be taken. |
285 WebRtcRTPHeader* aux_rtp_header_; | 284 rtc::scoped_ptr<WebRtcRTPHeader> aux_rtp_header_; |
286 | 285 |
287 bool receiver_initialized_ GUARDED_BY(acm_crit_sect_); | 286 bool receiver_initialized_ GUARDED_BY(acm_crit_sect_); |
288 | 287 |
289 AudioFrame preprocess_frame_ GUARDED_BY(acm_crit_sect_); | 288 AudioFrame preprocess_frame_ GUARDED_BY(acm_crit_sect_); |
290 bool first_10ms_data_ GUARDED_BY(acm_crit_sect_); | 289 bool first_10ms_data_ GUARDED_BY(acm_crit_sect_); |
291 | 290 |
292 bool first_frame_ GUARDED_BY(acm_crit_sect_); | 291 bool first_frame_ GUARDED_BY(acm_crit_sect_); |
293 uint32_t last_timestamp_ GUARDED_BY(acm_crit_sect_); | 292 uint32_t last_timestamp_ GUARDED_BY(acm_crit_sect_); |
294 uint32_t last_rtp_timestamp_ GUARDED_BY(acm_crit_sect_); | 293 uint32_t last_rtp_timestamp_ GUARDED_BY(acm_crit_sect_); |
295 | 294 |
296 CriticalSectionWrapper* callback_crit_sect_; | 295 const rtc::scoped_ptr<CriticalSectionWrapper> callback_crit_sect_; |
297 AudioPacketizationCallback* packetization_callback_ | 296 AudioPacketizationCallback* packetization_callback_ |
298 GUARDED_BY(callback_crit_sect_); | 297 GUARDED_BY(callback_crit_sect_); |
299 ACMVADCallback* vad_callback_ GUARDED_BY(callback_crit_sect_); | 298 ACMVADCallback* vad_callback_ GUARDED_BY(callback_crit_sect_); |
300 }; | 299 }; |
301 | 300 |
302 } // namespace acm2 | 301 } // namespace acm2 |
303 | 302 |
304 class AudioCodingImpl : public AudioCoding { | 303 class AudioCodingImpl : public AudioCoding { |
305 public: | 304 public: |
306 AudioCodingImpl(const Config& config); | 305 AudioCodingImpl(const Config& config); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 int playout_frequency_hz_; | 368 int playout_frequency_hz_; |
370 // TODO(henrik.lundin): All members below this line are temporary and should | 369 // TODO(henrik.lundin): All members below this line are temporary and should |
371 // be removed after refactoring is completed. | 370 // be removed after refactoring is completed. |
372 rtc::scoped_ptr<acm2::AudioCodingModuleImpl> acm_old_; | 371 rtc::scoped_ptr<acm2::AudioCodingModuleImpl> acm_old_; |
373 CodecInst current_send_codec_; | 372 CodecInst current_send_codec_; |
374 }; | 373 }; |
375 | 374 |
376 } // namespace webrtc | 375 } // namespace webrtc |
377 | 376 |
378 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_AUDIO_CODING_MODULE_IMPL_H_ | 377 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_AUDIO_CODING_MODULE_IMPL_H_ |
OLD | NEW |