OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 int red_payload_type) { | 195 int red_payload_type) { |
196 AudioEncoder* speech_encoder = SpeechEncoder(); | 196 AudioEncoder* speech_encoder = SpeechEncoder(); |
197 if (cng_payload_type != -1 || red_payload_type != -1) { | 197 if (cng_payload_type != -1 || red_payload_type != -1) { |
198 // The RED and CNG encoders need to be in sync with the speech encoder, so | 198 // The RED and CNG encoders need to be in sync with the speech encoder, so |
199 // reset the latter to ensure its buffer is empty. | 199 // reset the latter to ensure its buffer is empty. |
200 speech_encoder->Reset(); | 200 speech_encoder->Reset(); |
201 } | 201 } |
202 AudioEncoder* encoder = | 202 AudioEncoder* encoder = |
203 CreateRedEncoder(red_payload_type, speech_encoder, &red_encoder_); | 203 CreateRedEncoder(red_payload_type, speech_encoder, &red_encoder_); |
204 CreateCngEncoder(cng_payload_type, vad_mode, encoder, &cng_encoder_); | 204 CreateCngEncoder(cng_payload_type, vad_mode, encoder, &cng_encoder_); |
205 DCHECK_EQ(!!speech_encoder_ + !!external_speech_encoder_, 1); | 205 RTC_DCHECK_EQ(!!speech_encoder_ + !!external_speech_encoder_, 1); |
206 } | 206 } |
207 | 207 |
208 AudioDecoder* CodecOwner::GetIsacDecoder() { | 208 AudioDecoder* CodecOwner::GetIsacDecoder() { |
209 if (!isac_decoder_) | 209 if (!isac_decoder_) |
210 isac_decoder_ = CreateIsacDecoder(&isac_bandwidth_info_); | 210 isac_decoder_ = CreateIsacDecoder(&isac_bandwidth_info_); |
211 return isac_decoder_.get(); | 211 return isac_decoder_.get(); |
212 } | 212 } |
213 | 213 |
214 AudioEncoder* CodecOwner::Encoder() { | 214 AudioEncoder* CodecOwner::Encoder() { |
215 const auto& const_this = *this; | 215 const auto& const_this = *this; |
216 return const_cast<AudioEncoder*>(const_this.Encoder()); | 216 return const_cast<AudioEncoder*>(const_this.Encoder()); |
217 } | 217 } |
218 | 218 |
219 const AudioEncoder* CodecOwner::Encoder() const { | 219 const AudioEncoder* CodecOwner::Encoder() const { |
220 if (cng_encoder_) | 220 if (cng_encoder_) |
221 return cng_encoder_.get(); | 221 return cng_encoder_.get(); |
222 if (red_encoder_) | 222 if (red_encoder_) |
223 return red_encoder_.get(); | 223 return red_encoder_.get(); |
224 return SpeechEncoder(); | 224 return SpeechEncoder(); |
225 } | 225 } |
226 | 226 |
227 AudioEncoder* CodecOwner::SpeechEncoder() { | 227 AudioEncoder* CodecOwner::SpeechEncoder() { |
228 const auto* const_this = this; | 228 const auto* const_this = this; |
229 return const_cast<AudioEncoder*>(const_this->SpeechEncoder()); | 229 return const_cast<AudioEncoder*>(const_this->SpeechEncoder()); |
230 } | 230 } |
231 | 231 |
232 const AudioEncoder* CodecOwner::SpeechEncoder() const { | 232 const AudioEncoder* CodecOwner::SpeechEncoder() const { |
233 DCHECK(!speech_encoder_ || !external_speech_encoder_); | 233 RTC_DCHECK(!speech_encoder_ || !external_speech_encoder_); |
234 return external_speech_encoder_ ? external_speech_encoder_ | 234 return external_speech_encoder_ ? external_speech_encoder_ |
235 : speech_encoder_.get(); | 235 : speech_encoder_.get(); |
236 } | 236 } |
237 | 237 |
238 } // namespace acm2 | 238 } // namespace acm2 |
239 } // namespace webrtc | 239 } // namespace webrtc |
OLD | NEW |