Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1980 if (!WebRtcVoiceCodecs::SetPTimeAsPacketSize( | 1980 if (!WebRtcVoiceCodecs::SetPTimeAsPacketSize( |
| 1981 &send_codec_spec.codec_inst, ptime_ms)) { | 1981 &send_codec_spec.codec_inst, ptime_ms)) { |
| 1982 LOG(LS_WARNING) << "Failed to set packet size for codec " | 1982 LOG(LS_WARNING) << "Failed to set packet size for codec " |
| 1983 << send_codec_spec.codec_inst.plname; | 1983 << send_codec_spec.codec_inst.plname; |
| 1984 return false; | 1984 return false; |
| 1985 } | 1985 } |
| 1986 } | 1986 } |
| 1987 | 1987 |
| 1988 // Loop through the codecs list again to find the CN codec. | 1988 // Loop through the codecs list again to find the CN codec. |
| 1989 // TODO(solenberg): Break out into a separate function? | 1989 // TODO(solenberg): Break out into a separate function? |
| 1990 for (const AudioCodec& codec : codecs) { | 1990 for (const AudioCodec& cn_codec : codecs) { |
|
ossu
2017/03/01 23:24:37
ossu: Add a check here for if external CN is at al
ossu
2017/03/02 00:44:48
No, wait, I'm mixing this up with changes I haven'
| |
| 1991 // Ignore codecs we don't know about. The negotiation step should prevent | 1991 // Ignore codecs we don't know about. The negotiation step should prevent |
| 1992 // this, but double-check to be sure. | 1992 // this, but double-check to be sure. |
| 1993 webrtc::CodecInst voe_codec = {0}; | 1993 webrtc::CodecInst voe_codec = {0}; |
| 1994 if (!WebRtcVoiceEngine::ToCodecInst(codec, &voe_codec)) { | 1994 if (!WebRtcVoiceEngine::ToCodecInst(cn_codec, &voe_codec)) { |
| 1995 LOG(LS_WARNING) << "Unknown codec " << ToString(codec); | 1995 LOG(LS_WARNING) << "Unknown codec " << ToString(cn_codec); |
| 1996 continue; | 1996 continue; |
| 1997 } | 1997 } |
| 1998 | 1998 |
| 1999 if (IsCodec(codec, kCnCodecName)) { | 1999 if (IsCodec(cn_codec, kCnCodecName) && |
| 2000 cn_codec.clockrate == codec->clockrate) { | |
|
minyue-webrtc
2017/02/27 08:19:54
I am not familiar with the reason of the way it is
ossu
2017/03/01 23:24:38
From refactoring this further in my injectable aud
| |
| 2000 // Turn voice activity detection/comfort noise on if supported. | 2001 // Turn voice activity detection/comfort noise on if supported. |
| 2001 // Set the wideband CN payload type appropriately. | 2002 // Set the wideband CN payload type appropriately. |
| 2002 // (narrowband always uses the static payload type 13). | 2003 // (narrowband always uses the static payload type 13). |
| 2003 int cng_plfreq = -1; | 2004 int cng_plfreq = -1; |
| 2004 switch (codec.clockrate) { | 2005 switch (cn_codec.clockrate) { |
| 2005 case 8000: | 2006 case 8000: |
| 2006 case 16000: | 2007 case 16000: |
| 2007 case 32000: | 2008 case 32000: |
|
hlundin-webrtc
2017/02/27 08:00:52
You will have to check this, but I do think we can
ossu
2017/03/01 23:24:38
I think I recall the CN code dealing with that, no
ossu
2017/03/02 00:44:48
... which isn't used in this part of the code yet.
| |
| 2008 cng_plfreq = codec.clockrate; | 2009 cng_plfreq = cn_codec.clockrate; |
| 2009 break; | 2010 break; |
| 2010 default: | 2011 default: |
| 2011 LOG(LS_WARNING) << "CN frequency " << codec.clockrate | 2012 LOG(LS_WARNING) << "CN frequency " << cn_codec.clockrate |
| 2012 << " not supported."; | 2013 << " not supported."; |
| 2013 continue; | 2014 continue; |
| 2014 } | 2015 } |
| 2015 send_codec_spec.cng_payload_type = codec.id; | 2016 send_codec_spec.cng_payload_type = cn_codec.id; |
| 2016 send_codec_spec.cng_plfreq = cng_plfreq; | 2017 send_codec_spec.cng_plfreq = cng_plfreq; |
| 2017 break; | 2018 break; |
| 2018 } | 2019 } |
| 2019 } | 2020 } |
| 2020 | 2021 |
| 2021 // Find the telephone-event PT exactly matching the preferred send codec. | 2022 // Find the telephone-event PT exactly matching the preferred send codec. |
| 2022 for (const AudioCodec& dtmf_codec : dtmf_codecs) { | 2023 for (const AudioCodec& dtmf_codec : dtmf_codecs) { |
| 2023 if (dtmf_codec.clockrate == codec->clockrate) { | 2024 if (dtmf_codec.clockrate == codec->clockrate) { |
| 2024 dtmf_payload_type_ = rtc::Optional<int>(dtmf_codec.id); | 2025 dtmf_payload_type_ = rtc::Optional<int>(dtmf_codec.id); |
| 2025 dtmf_payload_freq_ = dtmf_codec.clockrate; | 2026 dtmf_payload_freq_ = dtmf_codec.clockrate; |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2662 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2663 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2663 const auto it = send_streams_.find(ssrc); | 2664 const auto it = send_streams_.find(ssrc); |
| 2664 if (it != send_streams_.end()) { | 2665 if (it != send_streams_.end()) { |
| 2665 return it->second->channel(); | 2666 return it->second->channel(); |
| 2666 } | 2667 } |
| 2667 return -1; | 2668 return -1; |
| 2668 } | 2669 } |
| 2669 } // namespace cricket | 2670 } // namespace cricket |
| 2670 | 2671 |
| 2671 #endif // HAVE_WEBRTC_VOICE | 2672 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |