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 |
11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ |
13 | 13 |
14 #include <stddef.h> | 14 #include <stddef.h> |
15 | 15 |
16 #include "webrtc/base/array_view.h" | 16 #include "webrtc/base/array_view.h" |
17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
18 #include "webrtc/base/optional.h" | 18 #include "webrtc/base/optional.h" |
19 #include "webrtc/base/scoped_ptr.h" | 19 #include "webrtc/base/scoped_ptr.h" |
| 20 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
| 21 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" |
| 22 #include "webrtc/modules/audio_coding/main/include/audio_coding_module_typedefs.
h" |
20 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
21 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" | |
22 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" | |
23 | 24 |
24 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) | 25 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) |
25 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" | 26 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" |
26 #else | 27 #else |
27 // Dummy implementation, for when we don't have iSAC. | 28 // Dummy implementation, for when we don't have iSAC. |
28 namespace webrtc { | 29 namespace webrtc { |
29 class LockedIsacBandwidthInfo {}; | 30 class LockedIsacBandwidthInfo {}; |
30 } | 31 } |
31 #endif | 32 #endif |
32 | 33 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 int num_channels); | 182 int num_channels); |
182 | 183 |
183 RentACodec(); | 184 RentACodec(); |
184 ~RentACodec(); | 185 ~RentACodec(); |
185 | 186 |
186 // Creates and returns an audio encoder built to the given specification. | 187 // Creates and returns an audio encoder built to the given specification. |
187 // Returns null in case of error. The returned encoder is live until the next | 188 // Returns null in case of error. The returned encoder is live until the next |
188 // successful call to this function, or until the Rent-A-Codec is destroyed. | 189 // successful call to this function, or until the Rent-A-Codec is destroyed. |
189 AudioEncoder* RentEncoder(const CodecInst& codec_inst); | 190 AudioEncoder* RentEncoder(const CodecInst& codec_inst); |
190 | 191 |
| 192 // Creates and returns an audio encoder stack where the given speech encoder |
| 193 // is augmented with the specified CNG/VAD and RED encoders. Leave either |
| 194 // optional field blank if you don't want the corresponding gizmo in the |
| 195 // stack. The returned encoder is live until the next successful call to this |
| 196 // function, or until the Rent-A-Codec is destroyed. |
| 197 struct CngConfig { |
| 198 int cng_payload_type; |
| 199 ACMVADMode vad_mode; |
| 200 }; |
| 201 AudioEncoder* RentEncoderStack(AudioEncoder* speech_encoder, |
| 202 rtc::Optional<CngConfig> cng_config, |
| 203 rtc::Optional<int> red_payload_type); |
| 204 |
| 205 // Get the last return values of RentEncoder and RentEncoderStack, or null if |
| 206 // they haven't been called. |
| 207 AudioEncoder* GetEncoder() const { return speech_encoder_.get(); } |
| 208 AudioEncoder* GetEncoderStack() const { return encoder_stack_; } |
| 209 |
191 // Creates and returns an iSAC decoder, which will remain live until the | 210 // Creates and returns an iSAC decoder, which will remain live until the |
192 // Rent-A-Codec is destroyed. Subsequent calls will simply return the same | 211 // Rent-A-Codec is destroyed. Subsequent calls will simply return the same |
193 // object. | 212 // object. |
194 AudioDecoder* RentIsacDecoder(); | 213 AudioDecoder* RentIsacDecoder(); |
195 | 214 |
196 private: | 215 private: |
197 rtc::scoped_ptr<AudioEncoder> encoder_; | 216 rtc::scoped_ptr<AudioEncoder> speech_encoder_; |
| 217 rtc::scoped_ptr<AudioEncoder> cng_encoder_; |
| 218 rtc::scoped_ptr<AudioEncoder> red_encoder_; |
198 rtc::scoped_ptr<AudioDecoder> isac_decoder_; | 219 rtc::scoped_ptr<AudioDecoder> isac_decoder_; |
| 220 AudioEncoder* encoder_stack_ = nullptr; |
199 LockedIsacBandwidthInfo isac_bandwidth_info_; | 221 LockedIsacBandwidthInfo isac_bandwidth_info_; |
200 | 222 |
201 RTC_DISALLOW_COPY_AND_ASSIGN(RentACodec); | 223 RTC_DISALLOW_COPY_AND_ASSIGN(RentACodec); |
202 }; | 224 }; |
203 | 225 |
204 } // namespace acm2 | 226 } // namespace acm2 |
205 } // namespace webrtc | 227 } // namespace webrtc |
206 | 228 |
207 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ | 229 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ |
OLD | NEW |