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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 bool AudioSendStream::SetupSendCodec() { | 285 bool AudioSendStream::SetupSendCodec() { |
286 ScopedVoEInterface<VoEBase> base(voice_engine()); | 286 ScopedVoEInterface<VoEBase> base(voice_engine()); |
287 ScopedVoEInterface<VoECodec> codec(voice_engine()); | 287 ScopedVoEInterface<VoECodec> codec(voice_engine()); |
288 | 288 |
289 const int channel = config_.voe_channel_id; | 289 const int channel = config_.voe_channel_id; |
290 | 290 |
291 // Disable VAD and FEC unless we know the other side wants them. | 291 // Disable VAD and FEC unless we know the other side wants them. |
292 codec->SetVADStatus(channel, false); | 292 codec->SetVADStatus(channel, false); |
293 codec->SetFECStatus(channel, false); | 293 codec->SetFECStatus(channel, false); |
294 | 294 |
| 295 // We disable audio network adaptor here. This will on one hand make sure that |
| 296 // audio network adaptor is disabled by default, and on the other allow audio |
| 297 // network adaptor to be reconfigured, since SetReceiverFrameLengthRange can |
| 298 // be only called when audio network adaptor is disabled. |
| 299 channel_proxy_->DisableAudioNetworkAdaptor(); |
| 300 |
295 const auto& send_codec_spec = config_.send_codec_spec; | 301 const auto& send_codec_spec = config_.send_codec_spec; |
296 | 302 |
297 // We set the codec first, since the below extra configuration is only applied | 303 // We set the codec first, since the below extra configuration is only applied |
298 // to the "current" codec. | 304 // to the "current" codec. |
299 | 305 |
300 // If codec is already configured, we do not it again. | 306 // If codec is already configured, we do not it again. |
301 // TODO(minyue): check if this check is really needed, or can we move it into | 307 // TODO(minyue): check if this check is really needed, or can we move it into |
302 // |codec->SetSendCodec|. | 308 // |codec->SetSendCodec|. |
303 webrtc::CodecInst current_codec = {0}; | 309 webrtc::CodecInst current_codec = {0}; |
304 if (codec->GetSendCodec(channel, current_codec) != 0 || | 310 if (codec->GetSendCodec(channel, current_codec) != 0 || |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 if (config_.audio_network_adaptor_config) { | 344 if (config_.audio_network_adaptor_config) { |
339 // Audio network adaptor is only allowed for Opus currently. | 345 // Audio network adaptor is only allowed for Opus currently. |
340 // |SetReceiverFrameLengthRange| needs to be called before | 346 // |SetReceiverFrameLengthRange| needs to be called before |
341 // |EnableAudioNetworkAdaptor|. | 347 // |EnableAudioNetworkAdaptor|. |
342 channel_proxy_->SetReceiverFrameLengthRange(send_codec_spec.min_ptime_ms, | 348 channel_proxy_->SetReceiverFrameLengthRange(send_codec_spec.min_ptime_ms, |
343 send_codec_spec.max_ptime_ms); | 349 send_codec_spec.max_ptime_ms); |
344 channel_proxy_->EnableAudioNetworkAdaptor( | 350 channel_proxy_->EnableAudioNetworkAdaptor( |
345 *config_.audio_network_adaptor_config); | 351 *config_.audio_network_adaptor_config); |
346 LOG(LS_INFO) << "Audio network adaptor enabled on SSRC " | 352 LOG(LS_INFO) << "Audio network adaptor enabled on SSRC " |
347 << config_.rtp.ssrc; | 353 << config_.rtp.ssrc; |
348 } else { | |
349 channel_proxy_->DisableAudioNetworkAdaptor(); | |
350 } | 354 } |
351 } | 355 } |
352 | 356 |
353 // Set the CN payloadtype and the VAD status. | 357 // Set the CN payloadtype and the VAD status. |
354 if (send_codec_spec.cng_payload_type != -1) { | 358 if (send_codec_spec.cng_payload_type != -1) { |
355 // The CN payload type for 8000 Hz clockrate is fixed at 13. | 359 // The CN payload type for 8000 Hz clockrate is fixed at 13. |
356 if (send_codec_spec.cng_plfreq != 8000) { | 360 if (send_codec_spec.cng_plfreq != 8000) { |
357 webrtc::PayloadFrequencies cn_freq; | 361 webrtc::PayloadFrequencies cn_freq; |
358 switch (send_codec_spec.cng_plfreq) { | 362 switch (send_codec_spec.cng_plfreq) { |
359 case 16000: | 363 case 16000: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 LOG(LS_WARNING) << "SetVADStatus() failed: " << base->LastError(); | 395 LOG(LS_WARNING) << "SetVADStatus() failed: " << base->LastError(); |
392 return false; | 396 return false; |
393 } | 397 } |
394 } | 398 } |
395 } | 399 } |
396 return true; | 400 return true; |
397 } | 401 } |
398 | 402 |
399 } // namespace internal | 403 } // namespace internal |
400 } // namespace webrtc | 404 } // namespace webrtc |
OLD | NEW |