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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 | 319 |
320 // Apply current codec settings to a single voe::Channel used for sending. | 320 // Apply current codec settings to a single voe::Channel used for sending. |
321 bool AudioSendStream::SetupSendCodec() { | 321 bool AudioSendStream::SetupSendCodec() { |
322 ScopedVoEInterface<VoEBase> base(voice_engine()); | 322 ScopedVoEInterface<VoEBase> base(voice_engine()); |
323 ScopedVoEInterface<VoECodec> codec(voice_engine()); | 323 ScopedVoEInterface<VoECodec> codec(voice_engine()); |
324 | 324 |
325 const int channel = config_.voe_channel_id; | 325 const int channel = config_.voe_channel_id; |
326 | 326 |
327 // Disable VAD and FEC unless we know the other side wants them. | 327 // Disable VAD and FEC unless we know the other side wants them. |
328 codec->SetVADStatus(channel, false); | 328 codec->SetVADStatus(channel, false); |
329 codec->SetFECStatus(channel, false); | 329 codec->SetFECStatus(channel, false); |
michaelt
2016/10/20 09:10:04
shouldn't we move this code to the corresponding s
minyue-webrtc
2016/10/20 09:22:11
I agree. This part should be refactored. This is n
| |
330 | 330 |
331 const auto& send_codec_spec = config_.send_codec_spec; | 331 const auto& send_codec_spec = config_.send_codec_spec; |
332 | 332 |
333 // Set the codec immediately, since SetVADStatus() depends on whether | 333 // Set the codec immediately, since SetVADStatus() depends on whether |
334 // the current codec is mono or stereo. | 334 // the current codec is mono or stereo. |
335 LOG(LS_INFO) << "Send channel " << channel << " selected voice codec " | 335 LOG(LS_INFO) << "Send channel " << channel << " selected voice codec " |
336 << ToString(send_codec_spec.codec_inst) | 336 << ToString(send_codec_spec.codec_inst) |
337 << ", bitrate=" << send_codec_spec.codec_inst.rate; | 337 << ", bitrate=" << send_codec_spec.codec_inst.rate; |
338 | 338 |
339 // If codec is already configured, we do not it again. | 339 // If codec is already configured, we do not it again. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 LOG(LS_INFO) << "Attempt to set maximum playback rate to " | 380 LOG(LS_INFO) << "Attempt to set maximum playback rate to " |
381 << send_codec_spec.opus_max_playback_rate | 381 << send_codec_spec.opus_max_playback_rate |
382 << " Hz on channel " << channel; | 382 << " Hz on channel " << channel; |
383 if (codec->SetOpusMaxPlaybackRate( | 383 if (codec->SetOpusMaxPlaybackRate( |
384 channel, send_codec_spec.opus_max_playback_rate) == -1) { | 384 channel, send_codec_spec.opus_max_playback_rate) == -1) { |
385 LOG_RTCERR2(SetOpusMaxPlaybackRate, channel, | 385 LOG_RTCERR2(SetOpusMaxPlaybackRate, channel, |
386 send_codec_spec.opus_max_playback_rate, base->LastError()); | 386 send_codec_spec.opus_max_playback_rate, base->LastError()); |
387 return false; | 387 return false; |
388 } | 388 } |
389 } | 389 } |
390 | |
391 if (config_.enable_audio_network_adaptor) { | |
392 // Audio network adaptor is only allowed for Opus currently. | |
393 // |SetReceiverFrameLengthRange| needs to be called before | |
394 // |EnableAudioNetworkAdaptor|. | |
395 channel_proxy_->SetReceiverFrameLengthRange(send_codec_spec.min_ptime_ms, | |
396 send_codec_spec.max_ptime_ms); | |
397 if (!channel_proxy_->EnableAudioNetworkAdaptor( | |
398 config_.audio_network_adaptor_config)) { | |
399 LOG(LS_ERROR) << "Audio network adaptor cannot be enabled on SSRC " | |
400 << config_.rtp.ssrc; | |
401 return false; | |
402 } | |
403 LOG(LS_INFO) << "Audio network adaptor enabled on SSRC " | |
404 << config_.rtp.ssrc; | |
405 } else { | |
406 channel_proxy_->DisableAudioNetworkAdaptor(); | |
407 } | |
390 } | 408 } |
391 | 409 |
392 // Set the CN payloadtype and the VAD status. | 410 // Set the CN payloadtype and the VAD status. |
393 if (send_codec_spec.cng_payload_type != -1) { | 411 if (send_codec_spec.cng_payload_type != -1) { |
394 // The CN payload type for 8000 Hz clockrate is fixed at 13. | 412 // The CN payload type for 8000 Hz clockrate is fixed at 13. |
395 if (send_codec_spec.cng_plfreq != 8000) { | 413 if (send_codec_spec.cng_plfreq != 8000) { |
396 webrtc::PayloadFrequencies cn_freq; | 414 webrtc::PayloadFrequencies cn_freq; |
397 switch (send_codec_spec.cng_plfreq) { | 415 switch (send_codec_spec.cng_plfreq) { |
398 case 16000: | 416 case 16000: |
399 cn_freq = webrtc::kFreq16000Hz; | 417 cn_freq = webrtc::kFreq16000Hz; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 LOG_RTCERR2(SetVADStatus, channel, true, base->LastError()); | 451 LOG_RTCERR2(SetVADStatus, channel, true, base->LastError()); |
434 return false; | 452 return false; |
435 } | 453 } |
436 } | 454 } |
437 } | 455 } |
438 return true; | 456 return true; |
439 } | 457 } |
440 | 458 |
441 } // namespace internal | 459 } // namespace internal |
442 } // namespace webrtc | 460 } // namespace webrtc |
OLD | NEW |