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 179 matching lines...) Loading... | |
190 enum class RegistrationResult { kOk, kSkip, kBadFreq }; | 190 enum class RegistrationResult { kOk, kSkip, kBadFreq }; |
191 static RegistrationResult RegisterCngPayloadType(std::map<int, int>* pt_map, | 191 static RegistrationResult RegisterCngPayloadType(std::map<int, int>* pt_map, |
192 const CodecInst& codec_inst); | 192 const CodecInst& codec_inst); |
193 static RegistrationResult RegisterRedPayloadType(std::map<int, int>* pt_map, | 193 static RegistrationResult RegisterRedPayloadType(std::map<int, int>* pt_map, |
194 const CodecInst& codec_inst); | 194 const CodecInst& codec_inst); |
195 | 195 |
196 RentACodec(); | 196 RentACodec(); |
197 ~RentACodec(); | 197 ~RentACodec(); |
198 | 198 |
199 // Creates and returns an audio encoder built to the given specification. | 199 // Creates and returns an audio encoder built to the given specification. |
200 // Returns null in case of error. The returned encoder is live until the next | 200 // Returns null in case of error. |
201 // successful call to this function, or until the Rent-A-Codec is destroyed. | 201 std::unique_ptr<AudioEncoder> RentEncoder(const CodecInst& codec_inst); |
hlundin-webrtc
2016/03/08 13:29:24
The name RentEncoder is no longer adequate, but I'
kwiberg-webrtc
2016/03/08 13:59:12
Yeah, the class name isn't a good fit anymore eith
| |
202 AudioEncoder* RentEncoder(const CodecInst& codec_inst); | |
203 | 202 |
204 struct StackParameters { | 203 struct StackParameters { |
205 StackParameters(); | 204 StackParameters(); |
206 ~StackParameters(); | 205 ~StackParameters(); |
207 | 206 |
208 AudioEncoder* speech_encoder = nullptr; | 207 std::unique_ptr<AudioEncoder> speech_encoder; |
208 | |
209 bool use_codec_fec = false; | 209 bool use_codec_fec = false; |
210 bool use_red = false; | 210 bool use_red = false; |
211 bool use_cng = false; | 211 bool use_cng = false; |
212 ACMVADMode vad_mode = VADNormal; | 212 ACMVADMode vad_mode = VADNormal; |
213 | 213 |
214 // Maps from RTP timestamp rate (in Hz) to payload type. | 214 // Maps from RTP timestamp rate (in Hz) to payload type. |
215 std::map<int, int> cng_payload_types; | 215 std::map<int, int> cng_payload_types; |
216 std::map<int, int> red_payload_types; | 216 std::map<int, int> red_payload_types; |
217 }; | 217 }; |
218 | 218 |
219 // Creates and returns an audio encoder stack constructed to the given | 219 // Creates and returns an audio encoder stack constructed to the given |
220 // specification. If the specification isn't compatible with the encoder, it | 220 // specification. If the specification isn't compatible with the encoder, it |
221 // will be changed to match (things will be switched off). The returned | 221 // will be changed to match (things will be switched off). The speech encoder |
222 // encoder is live until the next successful call to this function, or until | 222 // will be stolen. |
223 // the Rent-A-Codec is destroyed. | 223 std::unique_ptr<AudioEncoder> RentEncoderStack(StackParameters* param); |
224 AudioEncoder* RentEncoderStack(StackParameters* param); | |
225 | 224 |
226 // Creates and returns an iSAC decoder, which will remain live until the | 225 // Creates and returns an iSAC decoder, which will remain live until the |
227 // Rent-A-Codec is destroyed. Subsequent calls will simply return the same | 226 // Rent-A-Codec is destroyed. Subsequent calls will simply return the same |
228 // object. | 227 // object. |
229 AudioDecoder* RentIsacDecoder(); | 228 AudioDecoder* RentIsacDecoder(); |
230 | 229 |
231 private: | 230 private: |
232 std::unique_ptr<AudioEncoder> speech_encoder_; | 231 std::unique_ptr<AudioEncoder> speech_encoder_; |
233 std::unique_ptr<AudioEncoder> cng_encoder_; | 232 std::unique_ptr<AudioEncoder> cng_encoder_; |
234 std::unique_ptr<AudioEncoder> red_encoder_; | 233 std::unique_ptr<AudioEncoder> red_encoder_; |
235 std::unique_ptr<AudioDecoder> isac_decoder_; | 234 std::unique_ptr<AudioDecoder> isac_decoder_; |
236 LockedIsacBandwidthInfo isac_bandwidth_info_; | 235 LockedIsacBandwidthInfo isac_bandwidth_info_; |
237 | 236 |
238 RTC_DISALLOW_COPY_AND_ASSIGN(RentACodec); | 237 RTC_DISALLOW_COPY_AND_ASSIGN(RentACodec); |
239 }; | 238 }; |
240 | 239 |
241 } // namespace acm2 | 240 } // namespace acm2 |
242 } // namespace webrtc | 241 } // namespace webrtc |
243 | 242 |
244 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_RENT_A_CODEC_H_ | 243 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_RENT_A_CODEC_H_ |
OLD | NEW |