| 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 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 dtmf_payload_freq_ = codec.clockrate; | 1965 dtmf_payload_freq_ = codec.clockrate; |
| 1966 } | 1966 } |
| 1967 } | 1967 } |
| 1968 } | 1968 } |
| 1969 | 1969 |
| 1970 // Scan through the list to figure out the codec to use for sending, along | 1970 // Scan through the list to figure out the codec to use for sending, along |
| 1971 // with the proper configuration for VAD, CNG, NACK and Opus-specific | 1971 // with the proper configuration for VAD, CNG, NACK and Opus-specific |
| 1972 // parameters. | 1972 // parameters. |
| 1973 // TODO(solenberg): Refactor this logic once we create AudioEncoders here. | 1973 // TODO(solenberg): Refactor this logic once we create AudioEncoders here. |
| 1974 webrtc::AudioSendStream::Config::SendCodecSpec send_codec_spec; | 1974 webrtc::AudioSendStream::Config::SendCodecSpec send_codec_spec; |
| 1975 { | 1975 do { |
| 1976 send_codec_spec.nack_enabled = send_codec_spec_.nack_enabled; | 1976 send_codec_spec.nack_enabled = send_codec_spec_.nack_enabled; |
| 1977 | 1977 |
| 1978 // Find send codec (the first non-telephone-event/CN codec). | 1978 // Find send codec (the first non-telephone-event/CN codec). |
| 1979 const AudioCodec* codec = WebRtcVoiceCodecs::GetPreferredCodec( | 1979 const AudioCodec* codec = WebRtcVoiceCodecs::GetPreferredCodec( |
| 1980 codecs, &send_codec_spec.codec_inst); | 1980 codecs, &send_codec_spec.codec_inst); |
| 1981 if (!codec) { | 1981 if (!codec) { |
| 1982 LOG(LS_WARNING) << "Received empty list of codecs."; | 1982 LOG(LS_WARNING) << "Received empty list of codecs."; |
| 1983 return false; | 1983 break; |
| 1984 } | 1984 } |
| 1985 | 1985 |
| 1986 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec); | 1986 send_codec_spec.transport_cc_enabled = HasTransportCc(*codec); |
| 1987 send_codec_spec.nack_enabled = HasNack(*codec); | 1987 send_codec_spec.nack_enabled = HasNack(*codec); |
| 1988 bitrate_config_ = GetBitrateConfigForCodec(*codec); | 1988 bitrate_config_ = GetBitrateConfigForCodec(*codec); |
| 1989 | 1989 |
| 1990 // For Opus as the send codec, we are to determine inband FEC, maximum | 1990 // For Opus as the send codec, we are to determine inband FEC, maximum |
| 1991 // playback rate, and opus internal dtx. | 1991 // playback rate, and opus internal dtx. |
| 1992 if (IsCodec(*codec, kOpusCodecName)) { | 1992 if (IsCodec(*codec, kOpusCodecName)) { |
| 1993 GetOpusConfig(*codec, &send_codec_spec.codec_inst, | 1993 GetOpusConfig(*codec, &send_codec_spec.codec_inst, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 } | 2043 } |
| 2044 | 2044 |
| 2045 // Find the telephone-event PT exactly matching the preferred send codec. | 2045 // Find the telephone-event PT exactly matching the preferred send codec. |
| 2046 for (const AudioCodec& dtmf_codec : dtmf_codecs) { | 2046 for (const AudioCodec& dtmf_codec : dtmf_codecs) { |
| 2047 if (dtmf_codec.clockrate == codec->clockrate) { | 2047 if (dtmf_codec.clockrate == codec->clockrate) { |
| 2048 dtmf_payload_type_ = rtc::Optional<int>(dtmf_codec.id); | 2048 dtmf_payload_type_ = rtc::Optional<int>(dtmf_codec.id); |
| 2049 dtmf_payload_freq_ = dtmf_codec.clockrate; | 2049 dtmf_payload_freq_ = dtmf_codec.clockrate; |
| 2050 break; | 2050 break; |
| 2051 } | 2051 } |
| 2052 } | 2052 } |
| 2053 } | 2053 } while (0); |
| 2054 | 2054 |
| 2055 if (send_codec_spec_ != send_codec_spec) { | 2055 if (send_codec_spec_ != send_codec_spec) { |
| 2056 send_codec_spec_ = std::move(send_codec_spec); | 2056 send_codec_spec_ = std::move(send_codec_spec); |
| 2057 // Apply new settings to all streams. | 2057 // Apply new settings to all streams. |
| 2058 for (const auto& kv : send_streams_) { | 2058 for (const auto& kv : send_streams_) { |
| 2059 kv.second->RecreateAudioSendStream(send_codec_spec_); | 2059 kv.second->RecreateAudioSendStream(send_codec_spec_); |
| 2060 } | 2060 } |
| 2061 } else { | 2061 } else { |
| 2062 // If the codec isn't changing, set the start bitrate to -1 which means | 2062 // If the codec isn't changing, set the start bitrate to -1 which means |
| 2063 // "unchanged" so that BWE isn't affected. | 2063 // "unchanged" so that BWE isn't affected. |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2709 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2709 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2710 const auto it = send_streams_.find(ssrc); | 2710 const auto it = send_streams_.find(ssrc); |
| 2711 if (it != send_streams_.end()) { | 2711 if (it != send_streams_.end()) { |
| 2712 return it->second->channel(); | 2712 return it->second->channel(); |
| 2713 } | 2713 } |
| 2714 return -1; | 2714 return -1; |
| 2715 } | 2715 } |
| 2716 } // namespace cricket | 2716 } // namespace cricket |
| 2717 | 2717 |
| 2718 #endif // HAVE_WEBRTC_VOICE | 2718 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |