| 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_ACM2_AUDIO_CODING_MODULE_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_ACM2_AUDIO_CODING_MODULE_IMPL_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_ACM2_AUDIO_CODING_MODULE_IMPL_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_ACM2_AUDIO_CODING_MODULE_IMPL_H_ |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "webrtc/base/buffer.h" | 17 #include "webrtc/base/buffer.h" |
| 18 #include "webrtc/base/criticalsection.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_types.h" | 21 #include "webrtc/common_types.h" |
| 21 #include "webrtc/engine_configurations.h" | 22 #include "webrtc/engine_configurations.h" |
| 22 #include "webrtc/modules/audio_coding/acm2/acm_receiver.h" | 23 #include "webrtc/modules/audio_coding/acm2/acm_receiver.h" |
| 23 #include "webrtc/modules/audio_coding/acm2/acm_resampler.h" | 24 #include "webrtc/modules/audio_coding/acm2/acm_resampler.h" |
| 24 #include "webrtc/modules/audio_coding/acm2/codec_manager.h" | 25 #include "webrtc/modules/audio_coding/acm2/codec_manager.h" |
| 25 | 26 |
| 26 namespace webrtc { | 27 namespace webrtc { |
| 27 | 28 |
| 28 class CriticalSectionWrapper; | |
| 29 class AudioCodingImpl; | 29 class AudioCodingImpl; |
| 30 | 30 |
| 31 namespace acm2 { | 31 namespace acm2 { |
| 32 | 32 |
| 33 class AudioCodingModuleImpl final : public AudioCodingModule { | 33 class AudioCodingModuleImpl final : public AudioCodingModule { |
| 34 public: | 34 public: |
| 35 friend webrtc::AudioCodingImpl; | 35 friend webrtc::AudioCodingImpl; |
| 36 | 36 |
| 37 explicit AudioCodingModuleImpl(const AudioCodingModule::Config& config); | 37 explicit AudioCodingModuleImpl(const AudioCodingModule::Config& config); |
| 38 ~AudioCodingModuleImpl() override; | 38 ~AudioCodingModuleImpl() override; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // -1: if encountering an error. | 233 // -1: if encountering an error. |
| 234 // 0: otherwise. | 234 // 0: otherwise. |
| 235 int PreprocessToAddData(const AudioFrame& in_frame, | 235 int PreprocessToAddData(const AudioFrame& in_frame, |
| 236 const AudioFrame** ptr_out) | 236 const AudioFrame** ptr_out) |
| 237 EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_); | 237 EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_); |
| 238 | 238 |
| 239 // Change required states after starting to receive the codec corresponding | 239 // Change required states after starting to receive the codec corresponding |
| 240 // to |index|. | 240 // to |index|. |
| 241 int UpdateUponReceivingCodec(int index); | 241 int UpdateUponReceivingCodec(int index); |
| 242 | 242 |
| 243 const rtc::scoped_ptr<CriticalSectionWrapper> acm_crit_sect_; | 243 mutable rtc::CriticalSection acm_crit_sect_; |
| 244 rtc::Buffer encode_buffer_ GUARDED_BY(acm_crit_sect_); | 244 rtc::Buffer encode_buffer_ GUARDED_BY(acm_crit_sect_); |
| 245 int id_; // TODO(henrik.lundin) Make const. | 245 int id_; // TODO(henrik.lundin) Make const. |
| 246 uint32_t expected_codec_ts_ GUARDED_BY(acm_crit_sect_); | 246 uint32_t expected_codec_ts_ GUARDED_BY(acm_crit_sect_); |
| 247 uint32_t expected_in_ts_ GUARDED_BY(acm_crit_sect_); | 247 uint32_t expected_in_ts_ GUARDED_BY(acm_crit_sect_); |
| 248 ACMResampler resampler_ GUARDED_BY(acm_crit_sect_); | 248 ACMResampler resampler_ GUARDED_BY(acm_crit_sect_); |
| 249 AcmReceiver receiver_; // AcmReceiver has it's own internal lock. | 249 AcmReceiver receiver_; // AcmReceiver has it's own internal lock. |
| 250 ChangeLogger bitrate_logger_ GUARDED_BY(acm_crit_sect_); | 250 ChangeLogger bitrate_logger_ GUARDED_BY(acm_crit_sect_); |
| 251 CodecManager codec_manager_ GUARDED_BY(acm_crit_sect_); | 251 CodecManager codec_manager_ GUARDED_BY(acm_crit_sect_); |
| 252 RentACodec rent_a_codec_ GUARDED_BY(acm_crit_sect_); | 252 RentACodec rent_a_codec_ GUARDED_BY(acm_crit_sect_); |
| 253 | 253 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 264 | 264 |
| 265 bool receiver_initialized_ GUARDED_BY(acm_crit_sect_); | 265 bool receiver_initialized_ GUARDED_BY(acm_crit_sect_); |
| 266 | 266 |
| 267 AudioFrame preprocess_frame_ GUARDED_BY(acm_crit_sect_); | 267 AudioFrame preprocess_frame_ GUARDED_BY(acm_crit_sect_); |
| 268 bool first_10ms_data_ GUARDED_BY(acm_crit_sect_); | 268 bool first_10ms_data_ GUARDED_BY(acm_crit_sect_); |
| 269 | 269 |
| 270 bool first_frame_ GUARDED_BY(acm_crit_sect_); | 270 bool first_frame_ GUARDED_BY(acm_crit_sect_); |
| 271 uint32_t last_timestamp_ GUARDED_BY(acm_crit_sect_); | 271 uint32_t last_timestamp_ GUARDED_BY(acm_crit_sect_); |
| 272 uint32_t last_rtp_timestamp_ GUARDED_BY(acm_crit_sect_); | 272 uint32_t last_rtp_timestamp_ GUARDED_BY(acm_crit_sect_); |
| 273 | 273 |
| 274 const rtc::scoped_ptr<CriticalSectionWrapper> callback_crit_sect_; | 274 mutable rtc::CriticalSection callback_crit_sect_; |
| 275 AudioPacketizationCallback* packetization_callback_ | 275 AudioPacketizationCallback* packetization_callback_ |
| 276 GUARDED_BY(callback_crit_sect_); | 276 GUARDED_BY(callback_crit_sect_); |
| 277 ACMVADCallback* vad_callback_ GUARDED_BY(callback_crit_sect_); | 277 ACMVADCallback* vad_callback_ GUARDED_BY(callback_crit_sect_); |
| 278 }; | 278 }; |
| 279 | 279 |
| 280 } // namespace acm2 | 280 } // namespace acm2 |
| 281 } // namespace webrtc | 281 } // namespace webrtc |
| 282 | 282 |
| 283 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_AUDIO_CODING_MODULE_IMPL_H_ | 283 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_AUDIO_CODING_MODULE_IMPL_H_ |
| OLD | NEW |