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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 const bool stereo_send = | 159 const bool stereo_send = |
160 codec_stack_params_.speech_encoder | 160 codec_stack_params_.speech_encoder |
161 ? (codec_stack_params_.speech_encoder->NumChannels() != 1) | 161 ? (codec_stack_params_.speech_encoder->NumChannels() != 1) |
162 : false; | 162 : false; |
163 if (enable && stereo_send) { | 163 if (enable && stereo_send) { |
164 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, 0, | 164 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, 0, |
165 "VAD/DTX not supported for stereo sending"); | 165 "VAD/DTX not supported for stereo sending"); |
166 return false; | 166 return false; |
167 } | 167 } |
168 | 168 |
169 if (CurrentEncoderIsOpus()) { | 169 // TODO(kwiberg): This doesn't protect Opus when injected as an external |
170 // encoder. | |
kwiberg-webrtc
2015/12/15 11:59:12
Henrik, this is the thing I brought up at lunch. T
hlundin-webrtc
2015/12/15 13:46:36
Acknowledged.
| |
171 if (send_codec_inst_ && IsOpus(*send_codec_inst_)) { | |
170 // VAD/DTX not supported, but don't fail. | 172 // VAD/DTX not supported, but don't fail. |
171 enable = false; | 173 enable = false; |
172 } | 174 } |
173 | 175 |
174 codec_stack_params_.use_cng = enable; | 176 codec_stack_params_.use_cng = enable; |
175 codec_stack_params_.vad_mode = mode; | 177 codec_stack_params_.vad_mode = mode; |
176 return true; | 178 return true; |
177 } | 179 } |
178 | 180 |
179 bool CodecManager::SetCodecFEC(bool enable_codec_fec) { | 181 bool CodecManager::SetCodecFEC(bool enable_codec_fec) { |
180 if (enable_codec_fec && codec_stack_params_.use_red) { | 182 if (enable_codec_fec && codec_stack_params_.use_red) { |
181 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0, | 183 WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceAudioCoding, 0, |
182 "Codec internal FEC and RED cannot be co-enabled."); | 184 "Codec internal FEC and RED cannot be co-enabled."); |
183 return false; | 185 return false; |
184 } | 186 } |
185 | 187 |
186 codec_stack_params_.use_codec_fec = enable_codec_fec; | 188 codec_stack_params_.use_codec_fec = enable_codec_fec; |
187 return true; | 189 return true; |
188 } | 190 } |
189 | 191 |
190 bool CodecManager::CurrentEncoderIsOpus() const { | |
191 return send_codec_inst_ ? IsOpus(*send_codec_inst_) : false; | |
192 } | |
193 | |
194 } // namespace acm2 | 192 } // namespace acm2 |
195 } // namespace webrtc | 193 } // namespace webrtc |
OLD | NEW |