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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 int PreprocessToAddData(const AudioFrame& in_frame, | 262 int PreprocessToAddData(const AudioFrame& in_frame, |
263 const AudioFrame** ptr_out) | 263 const AudioFrame** ptr_out) |
264 RTC_EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_); | 264 RTC_EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_); |
265 | 265 |
266 // Change required states after starting to receive the codec corresponding | 266 // Change required states after starting to receive the codec corresponding |
267 // to |index|. | 267 // to |index|. |
268 int UpdateUponReceivingCodec(int index); | 268 int UpdateUponReceivingCodec(int index); |
269 | 269 |
270 rtc::CriticalSection acm_crit_sect_; | 270 rtc::CriticalSection acm_crit_sect_; |
271 rtc::Buffer encode_buffer_ RTC_GUARDED_BY(acm_crit_sect_); | 271 rtc::Buffer encode_buffer_ RTC_GUARDED_BY(acm_crit_sect_); |
272 int id_; // TODO(henrik.lundin) Make const. | |
273 uint32_t expected_codec_ts_ RTC_GUARDED_BY(acm_crit_sect_); | 272 uint32_t expected_codec_ts_ RTC_GUARDED_BY(acm_crit_sect_); |
274 uint32_t expected_in_ts_ RTC_GUARDED_BY(acm_crit_sect_); | 273 uint32_t expected_in_ts_ RTC_GUARDED_BY(acm_crit_sect_); |
275 acm2::ACMResampler resampler_ RTC_GUARDED_BY(acm_crit_sect_); | 274 acm2::ACMResampler resampler_ RTC_GUARDED_BY(acm_crit_sect_); |
276 acm2::AcmReceiver receiver_; // AcmReceiver has it's own internal lock. | 275 acm2::AcmReceiver receiver_; // AcmReceiver has it's own internal lock. |
277 ChangeLogger bitrate_logger_ RTC_GUARDED_BY(acm_crit_sect_); | 276 ChangeLogger bitrate_logger_ RTC_GUARDED_BY(acm_crit_sect_); |
278 | 277 |
279 std::unique_ptr<EncoderFactory> encoder_factory_ | 278 std::unique_ptr<EncoderFactory> encoder_factory_ |
280 RTC_GUARDED_BY(acm_crit_sect_); | 279 RTC_GUARDED_BY(acm_crit_sect_); |
281 | 280 |
282 // Current encoder stack, either obtained from | 281 // Current encoder stack, either obtained from |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 void AudioCodingModuleImpl::ChangeLogger::MaybeLog(int value) { | 448 void AudioCodingModuleImpl::ChangeLogger::MaybeLog(int value) { |
450 if (value != last_value_ || first_time_) { | 449 if (value != last_value_ || first_time_) { |
451 first_time_ = false; | 450 first_time_ = false; |
452 last_value_ = value; | 451 last_value_ = value; |
453 RTC_HISTOGRAM_COUNTS_SPARSE_100(histogram_name_, value); | 452 RTC_HISTOGRAM_COUNTS_SPARSE_100(histogram_name_, value); |
454 } | 453 } |
455 } | 454 } |
456 | 455 |
457 AudioCodingModuleImpl::AudioCodingModuleImpl( | 456 AudioCodingModuleImpl::AudioCodingModuleImpl( |
458 const AudioCodingModule::Config& config) | 457 const AudioCodingModule::Config& config) |
459 : id_(config.id), | 458 : expected_codec_ts_(0xD87F3F9F), |
460 expected_codec_ts_(0xD87F3F9F), | |
461 expected_in_ts_(0xD87F3F9F), | 459 expected_in_ts_(0xD87F3F9F), |
462 receiver_(config), | 460 receiver_(config), |
463 bitrate_logger_("WebRTC.Audio.TargetBitrateInKbps"), | 461 bitrate_logger_("WebRTC.Audio.TargetBitrateInKbps"), |
464 encoder_factory_(new EncoderFactory), | 462 encoder_factory_(new EncoderFactory), |
465 encoder_stack_(nullptr), | 463 encoder_stack_(nullptr), |
466 previous_pltype_(255), | 464 previous_pltype_(255), |
467 receiver_initialized_(false), | 465 receiver_initialized_(false), |
468 first_10ms_data_(false), | 466 first_10ms_data_(false), |
469 first_frame_(true), | 467 first_frame_(true), |
470 packetization_callback_(NULL), | 468 packetization_callback_(NULL), |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 // Get 10 milliseconds of raw audio data to play out. | 1111 // Get 10 milliseconds of raw audio data to play out. |
1114 // Automatic resample to the requested frequency. | 1112 // Automatic resample to the requested frequency. |
1115 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz, | 1113 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz, |
1116 AudioFrame* audio_frame, | 1114 AudioFrame* audio_frame, |
1117 bool* muted) { | 1115 bool* muted) { |
1118 // GetAudio always returns 10 ms, at the requested sample rate. | 1116 // GetAudio always returns 10 ms, at the requested sample rate. |
1119 if (receiver_.GetAudio(desired_freq_hz, audio_frame, muted) != 0) { | 1117 if (receiver_.GetAudio(desired_freq_hz, audio_frame, muted) != 0) { |
1120 LOG(LS_ERROR) << "PlayoutData failed, RecOut Failed"; | 1118 LOG(LS_ERROR) << "PlayoutData failed, RecOut Failed"; |
1121 return -1; | 1119 return -1; |
1122 } | 1120 } |
1123 audio_frame->id_ = id_; | |
1124 return 0; | 1121 return 0; |
1125 } | 1122 } |
1126 | 1123 |
1127 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz, | 1124 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz, |
1128 AudioFrame* audio_frame) { | 1125 AudioFrame* audio_frame) { |
1129 bool muted; | 1126 bool muted; |
1130 int ret = PlayoutData10Ms(desired_freq_hz, audio_frame, &muted); | 1127 int ret = PlayoutData10Ms(desired_freq_hz, audio_frame, &muted); |
1131 RTC_DCHECK(!muted); | 1128 RTC_DCHECK(!muted); |
1132 return ret; | 1129 return ret; |
1133 } | 1130 } |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 | 1370 |
1374 // Checks the validity of the parameters of the given codec | 1371 // Checks the validity of the parameters of the given codec |
1375 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { | 1372 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { |
1376 bool valid = acm2::RentACodec::IsCodecValid(codec); | 1373 bool valid = acm2::RentACodec::IsCodecValid(codec); |
1377 if (!valid) | 1374 if (!valid) |
1378 LOG(LS_ERROR) << "Invalid codec setting"; | 1375 LOG(LS_ERROR) << "Invalid codec setting"; |
1379 return valid; | 1376 return valid; |
1380 } | 1377 } |
1381 | 1378 |
1382 } // namespace webrtc | 1379 } // namespace webrtc |
OLD | NEW |