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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 kDecoderOpus, | 126 kDecoderOpus, |
127 kDecoderOpus_2ch, | 127 kDecoderOpus_2ch, |
128 }; | 128 }; |
129 | 129 |
130 static inline size_t NumberOfCodecs() { | 130 static inline size_t NumberOfCodecs() { |
131 return static_cast<size_t>(CodecId::kNumCodecs); | 131 return static_cast<size_t>(CodecId::kNumCodecs); |
132 } | 132 } |
133 | 133 |
134 static inline rtc::Maybe<int> CodecIndexFromId(CodecId codec_id) { | 134 static inline rtc::Maybe<int> CodecIndexFromId(CodecId codec_id) { |
135 const int i = static_cast<int>(codec_id); | 135 const int i = static_cast<int>(codec_id); |
136 return i < static_cast<int>(NumberOfCodecs()) ? i : rtc::Maybe<int>(); | 136 return i < static_cast<int>(NumberOfCodecs()) ? rtc::Maybe<int>(i) |
| 137 : rtc::Maybe<int>(); |
137 } | 138 } |
138 | 139 |
139 static inline rtc::Maybe<CodecId> CodecIdFromIndex(int codec_index) { | 140 static inline rtc::Maybe<CodecId> CodecIdFromIndex(int codec_index) { |
140 return static_cast<size_t>(codec_index) < NumberOfCodecs() | 141 return static_cast<size_t>(codec_index) < NumberOfCodecs() |
141 ? static_cast<RentACodec::CodecId>(codec_index) | 142 ? rtc::Maybe<RentACodec::CodecId>( |
| 143 static_cast<RentACodec::CodecId>(codec_index)) |
142 : rtc::Maybe<RentACodec::CodecId>(); | 144 : rtc::Maybe<RentACodec::CodecId>(); |
143 } | 145 } |
144 | 146 |
145 static rtc::Maybe<CodecId> CodecIdByParams(const char* payload_name, | 147 static rtc::Maybe<CodecId> CodecIdByParams(const char* payload_name, |
146 int sampling_freq_hz, | 148 int sampling_freq_hz, |
147 int channels); | 149 int channels); |
148 static rtc::Maybe<CodecInst> CodecInstById(CodecId codec_id); | 150 static rtc::Maybe<CodecInst> CodecInstById(CodecId codec_id); |
149 static rtc::Maybe<CodecInst> CodecInstByParams(const char* payload_name, | 151 static rtc::Maybe<CodecInst> CodecInstByParams(const char* payload_name, |
150 int sampling_freq_hz, | 152 int sampling_freq_hz, |
151 int channels); | 153 int channels); |
152 static bool IsCodecValid(const CodecInst& codec_inst); | 154 static bool IsCodecValid(const CodecInst& codec_inst); |
153 static rtc::ArrayView<const CodecInst> Database(); | 155 static rtc::ArrayView<const CodecInst> Database(); |
154 | 156 |
155 static rtc::Maybe<NetEqDecoder> NetEqDecoderFromCodecId(CodecId codec_id, | 157 static rtc::Maybe<NetEqDecoder> NetEqDecoderFromCodecId(CodecId codec_id, |
156 int num_channels); | 158 int num_channels); |
157 }; | 159 }; |
158 | 160 |
159 } // namespace acm2 | 161 } // namespace acm2 |
160 } // namespace webrtc | 162 } // namespace webrtc |
161 | 163 |
162 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ | 164 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ |
OLD | NEW |