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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return rtc_make_scoped_ptr(new AudioEncoderG722(speech_inst)); | 124 return rtc_make_scoped_ptr(new AudioEncoderG722(speech_inst)); |
125 } else { | 125 } else { |
126 FATAL() << "Could not create encoder of type " << speech_inst.plname; | 126 FATAL() << "Could not create encoder of type " << speech_inst.plname; |
127 return rtc::scoped_ptr<AudioEncoder>(); | 127 return rtc::scoped_ptr<AudioEncoder>(); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 AudioEncoder* CreateRedEncoder(int red_payload_type, | 131 AudioEncoder* CreateRedEncoder(int red_payload_type, |
132 AudioEncoder* encoder, | 132 AudioEncoder* encoder, |
133 rtc::scoped_ptr<AudioEncoder>* red_encoder) { | 133 rtc::scoped_ptr<AudioEncoder>* red_encoder) { |
134 if (red_payload_type == -1) { | 134 #ifdef WEBRTC_CODEC_RED |
135 red_encoder->reset(); | 135 if (red_payload_type != -1) { |
136 return encoder; | 136 AudioEncoderCopyRed::Config config; |
| 137 config.payload_type = red_payload_type; |
| 138 config.speech_encoder = encoder; |
| 139 red_encoder->reset(new AudioEncoderCopyRed(config)); |
| 140 return red_encoder->get(); |
137 } | 141 } |
138 AudioEncoderCopyRed::Config config; | 142 #endif |
139 config.payload_type = red_payload_type; | 143 |
140 config.speech_encoder = encoder; | 144 red_encoder->reset(); |
141 red_encoder->reset(new AudioEncoderCopyRed(config)); | 145 return encoder; |
142 return red_encoder->get(); | |
143 } | 146 } |
144 | 147 |
145 void CreateCngEncoder(int cng_payload_type, | 148 void CreateCngEncoder(int cng_payload_type, |
146 ACMVADMode vad_mode, | 149 ACMVADMode vad_mode, |
147 AudioEncoder* encoder, | 150 AudioEncoder* encoder, |
148 rtc::scoped_ptr<AudioEncoder>* cng_encoder) { | 151 rtc::scoped_ptr<AudioEncoder>* cng_encoder) { |
149 if (cng_payload_type == -1) { | 152 if (cng_payload_type == -1) { |
150 cng_encoder->reset(); | 153 cng_encoder->reset(); |
151 return; | 154 return; |
152 } | 155 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 235 } |
233 | 236 |
234 const AudioEncoder* CodecOwner::SpeechEncoder() const { | 237 const AudioEncoder* CodecOwner::SpeechEncoder() const { |
235 RTC_DCHECK(!speech_encoder_ || !external_speech_encoder_); | 238 RTC_DCHECK(!speech_encoder_ || !external_speech_encoder_); |
236 return external_speech_encoder_ ? external_speech_encoder_ | 239 return external_speech_encoder_ ? external_speech_encoder_ |
237 : speech_encoder_.get(); | 240 : speech_encoder_.get(); |
238 } | 241 } |
239 | 242 |
240 } // namespace acm2 | 243 } // namespace acm2 |
241 } // namespace webrtc | 244 } // namespace webrtc |
OLD | NEW |