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/maybe.h" | 18 #include "webrtc/base/maybe.h" |
| 19 #include "webrtc/base/scoped_ptr.h" |
18 #include "webrtc/typedefs.h" | 20 #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 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) |
| 25 #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" |
| 26 #else |
| 27 // Dummy implementation, for when we don't have iSAC. |
| 28 namespace webrtc { |
| 29 class LockedIsacBandwidthInfo {}; |
| 30 } |
| 31 #endif |
19 | 32 |
20 namespace webrtc { | 33 namespace webrtc { |
21 | 34 |
22 struct CodecInst; | 35 struct CodecInst; |
23 | 36 |
24 namespace acm2 { | 37 namespace acm2 { |
25 | 38 |
26 class RentACodec { | 39 class RentACodec { |
27 public: | 40 public: |
28 enum class CodecId { | 41 enum class CodecId { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 return payload_type >= 0 && payload_type <= 127; | 171 return payload_type >= 0 && payload_type <= 127; |
159 } | 172 } |
160 | 173 |
161 static rtc::ArrayView<const CodecInst> Database(); | 174 static rtc::ArrayView<const CodecInst> Database(); |
162 | 175 |
163 static rtc::Maybe<bool> IsSupportedNumChannels(CodecId codec_id, | 176 static rtc::Maybe<bool> IsSupportedNumChannels(CodecId codec_id, |
164 int num_channels); | 177 int num_channels); |
165 | 178 |
166 static rtc::Maybe<NetEqDecoder> NetEqDecoderFromCodecId(CodecId codec_id, | 179 static rtc::Maybe<NetEqDecoder> NetEqDecoderFromCodecId(CodecId codec_id, |
167 int num_channels); | 180 int num_channels); |
| 181 |
| 182 RentACodec(); |
| 183 ~RentACodec(); |
| 184 |
| 185 // Creates and returns an audio encoder built to the given specification. |
| 186 // Returns null in case of error. The returned encoder is live until the next |
| 187 // successful call to this function, or until the Rent-A-Codec is destroyed. |
| 188 AudioEncoder* RentEncoder(const CodecInst& codec_inst); |
| 189 |
| 190 // Creates and returns an iSAC decoder, which will remain live until the |
| 191 // Rent-A-Codec is destroyed. Subsequent calls will simply return the same |
| 192 // object. |
| 193 AudioDecoder* RentIsacDecoder(); |
| 194 |
| 195 private: |
| 196 rtc::scoped_ptr<AudioEncoder> encoder_; |
| 197 rtc::scoped_ptr<AudioDecoder> isac_decoder_; |
| 198 LockedIsacBandwidthInfo isac_bandwidth_info_; |
| 199 |
| 200 RTC_DISALLOW_COPY_AND_ASSIGN(RentACodec); |
168 }; | 201 }; |
169 | 202 |
170 } // namespace acm2 | 203 } // namespace acm2 |
171 } // namespace webrtc | 204 } // namespace webrtc |
172 | 205 |
173 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ | 206 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ |
OLD | NEW |