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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 auto i = RentACodec::CodecIdFromIndex(codec_id); | 111 auto i = RentACodec::CodecIdFromIndex(codec_id); |
112 return (i && (*i == RentACodec::CodecId::kCNNB || | 112 return (i && (*i == RentACodec::CodecId::kCNNB || |
113 *i == RentACodec::CodecId::kCNWB || | 113 *i == RentACodec::CodecId::kCNWB || |
114 *i == RentACodec::CodecId::kCNSWB || | 114 *i == RentACodec::CodecId::kCNSWB || |
115 *i == RentACodec::CodecId::kCNFB)); | 115 *i == RentACodec::CodecId::kCNFB)); |
116 } | 116 } |
117 | 117 |
118 } // namespace | 118 } // namespace |
119 | 119 |
120 AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config) | 120 AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config) |
121 : id_(config.id), | 121 : last_audio_decoder_(nullptr), |
122 last_audio_decoder_(nullptr), | |
123 previous_audio_activity_(AudioFrame::kVadPassive), | 122 previous_audio_activity_(AudioFrame::kVadPassive), |
124 audio_buffer_(new int16_t[AudioFrame::kMaxDataSizeSamples]), | 123 audio_buffer_(new int16_t[AudioFrame::kMaxDataSizeSamples]), |
125 last_audio_buffer_(new int16_t[AudioFrame::kMaxDataSizeSamples]), | 124 last_audio_buffer_(new int16_t[AudioFrame::kMaxDataSizeSamples]), |
126 neteq_(NetEq::Create(config.neteq_config)), | 125 neteq_(NetEq::Create(config.neteq_config)), |
127 vad_enabled_(config.neteq_config.enable_post_decode_vad), | 126 vad_enabled_(config.neteq_config.enable_post_decode_vad), |
128 clock_(config.clock), | 127 clock_(config.clock), |
129 resampled_last_output_frame_(true) { | 128 resampled_last_output_frame_(true) { |
130 assert(clock_); | 129 assert(clock_); |
131 memset(audio_buffer_.get(), 0, AudioFrame::kMaxDataSizeSamples); | 130 memset(audio_buffer_.get(), 0, AudioFrame::kMaxDataSizeSamples); |
132 memset(last_audio_buffer_.get(), 0, AudioFrame::kMaxDataSizeSamples); | 131 memset(last_audio_buffer_.get(), 0, AudioFrame::kMaxDataSizeSamples); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return -1; | 411 return -1; |
413 } | 412 } |
414 if (last_audio_decoder_ == &it->second) { | 413 if (last_audio_decoder_ == &it->second) { |
415 last_audio_decoder_ = nullptr; | 414 last_audio_decoder_ = nullptr; |
416 last_packet_sample_rate_hz_ = rtc::Optional<int>(); | 415 last_packet_sample_rate_hz_ = rtc::Optional<int>(); |
417 } | 416 } |
418 decoders_.erase(it); | 417 decoders_.erase(it); |
419 return 0; | 418 return 0; |
420 } | 419 } |
421 | 420 |
422 void AcmReceiver::set_id(int id) { | |
423 rtc::CritScope lock(&crit_sect_); | |
424 id_ = id; | |
425 } | |
426 | |
427 bool AcmReceiver::GetPlayoutTimestamp(uint32_t* timestamp) { | 421 bool AcmReceiver::GetPlayoutTimestamp(uint32_t* timestamp) { |
428 return neteq_->GetPlayoutTimestamp(timestamp); | 422 return neteq_->GetPlayoutTimestamp(timestamp); |
429 } | 423 } |
430 | 424 |
431 int AcmReceiver::LastAudioCodec(CodecInst* codec) const { | 425 int AcmReceiver::LastAudioCodec(CodecInst* codec) const { |
432 rtc::CritScope lock(&crit_sect_); | 426 rtc::CritScope lock(&crit_sect_); |
433 if (!last_audio_decoder_) { | 427 if (!last_audio_decoder_) { |
434 return -1; | 428 return -1; |
435 } | 429 } |
436 *codec = *RentACodec::CodecInstById( | 430 *codec = *RentACodec::CodecInstById( |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 | 524 |
531 void AcmReceiver::GetDecodingCallStatistics( | 525 void AcmReceiver::GetDecodingCallStatistics( |
532 AudioDecodingCallStats* stats) const { | 526 AudioDecodingCallStats* stats) const { |
533 rtc::CritScope lock(&crit_sect_); | 527 rtc::CritScope lock(&crit_sect_); |
534 *stats = call_stats_.GetDecodingStatistics(); | 528 *stats = call_stats_.GetDecodingStatistics(); |
535 } | 529 } |
536 | 530 |
537 } // namespace acm2 | 531 } // namespace acm2 |
538 | 532 |
539 } // namespace webrtc | 533 } // namespace webrtc |
OLD | NEW |