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 #include <map> |
15 | 16 |
16 #include "webrtc/base/array_view.h" | 17 #include "webrtc/base/array_view.h" |
17 #include "webrtc/base/constructormagic.h" | 18 #include "webrtc/base/constructormagic.h" |
18 #include "webrtc/base/optional.h" | 19 #include "webrtc/base/optional.h" |
19 #include "webrtc/base/scoped_ptr.h" | 20 #include "webrtc/base/scoped_ptr.h" |
20 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" | 21 #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/codecs/audio_encoder.h" |
22 #include "webrtc/modules/audio_coding/main/include/audio_coding_module_typedefs.
h" | 23 #include "webrtc/modules/audio_coding/main/include/audio_coding_module_typedefs.
h" |
23 #include "webrtc/typedefs.h" | 24 #include "webrtc/typedefs.h" |
24 | 25 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 175 } |
175 | 176 |
176 static rtc::ArrayView<const CodecInst> Database(); | 177 static rtc::ArrayView<const CodecInst> Database(); |
177 | 178 |
178 static rtc::Optional<bool> IsSupportedNumChannels(CodecId codec_id, | 179 static rtc::Optional<bool> IsSupportedNumChannels(CodecId codec_id, |
179 int num_channels); | 180 int num_channels); |
180 | 181 |
181 static rtc::Optional<NetEqDecoder> NetEqDecoderFromCodecId(CodecId codec_id, | 182 static rtc::Optional<NetEqDecoder> NetEqDecoderFromCodecId(CodecId codec_id, |
182 int num_channels); | 183 int num_channels); |
183 | 184 |
| 185 // Parse codec_inst and extract payload types. If the given CodecInst was for |
| 186 // the wrong sort of codec, return kSkip; otherwise, if the rate was illegal, |
| 187 // return kBadFreq; otherwise, update the given RTP timestamp rate (Hz) -> |
| 188 // payload type map and return kOk. |
| 189 enum class RegistrationResult { kOk, kSkip, kBadFreq }; |
| 190 static RegistrationResult RegisterCngPayloadType(std::map<int, int>* pt_map, |
| 191 const CodecInst& codec_inst); |
| 192 static RegistrationResult RegisterRedPayloadType(std::map<int, int>* pt_map, |
| 193 const CodecInst& codec_inst); |
| 194 |
184 RentACodec(); | 195 RentACodec(); |
185 ~RentACodec(); | 196 ~RentACodec(); |
186 | 197 |
187 // Creates and returns an audio encoder built to the given specification. | 198 // Creates and returns an audio encoder built to the given specification. |
188 // Returns null in case of error. The returned encoder is live until the next | 199 // Returns null in case of error. The returned encoder is live until the next |
189 // successful call to this function, or until the Rent-A-Codec is destroyed. | 200 // successful call to this function, or until the Rent-A-Codec is destroyed. |
190 AudioEncoder* RentEncoder(const CodecInst& codec_inst); | 201 AudioEncoder* RentEncoder(const CodecInst& codec_inst); |
191 | 202 |
192 // Creates and returns an audio encoder stack where the given speech encoder | 203 // 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 | 204 // is augmented with the specified CNG/VAD and RED encoders. Leave either |
(...skipping 26 matching lines...) Expand all Loading... |
220 AudioEncoder* encoder_stack_ = nullptr; | 231 AudioEncoder* encoder_stack_ = nullptr; |
221 LockedIsacBandwidthInfo isac_bandwidth_info_; | 232 LockedIsacBandwidthInfo isac_bandwidth_info_; |
222 | 233 |
223 RTC_DISALLOW_COPY_AND_ASSIGN(RentACodec); | 234 RTC_DISALLOW_COPY_AND_ASSIGN(RentACodec); |
224 }; | 235 }; |
225 | 236 |
226 } // namespace acm2 | 237 } // namespace acm2 |
227 } // namespace webrtc | 238 } // namespace webrtc |
228 | 239 |
229 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ | 240 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ |
OLD | NEW |