Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/acm_codec_database.h

Issue 1360123002: ACMCodecDB: Remove unused stuff, and move private stuff to anonymous namespace (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // Codec specific settings 118 // Codec specific settings
119 // 119 //
120 // num_packet_sizes - number of allowed packet sizes. 120 // num_packet_sizes - number of allowed packet sizes.
121 // packet_sizes_samples - list of the allowed packet sizes. 121 // packet_sizes_samples - list of the allowed packet sizes.
122 // basic_block_samples - assigned a value different from 0 if the codec 122 // basic_block_samples - assigned a value different from 0 if the codec
123 // requires to be fed with a specific number of samples 123 // requires to be fed with a specific number of samples
124 // that can be different from packet size. 124 // that can be different from packet size.
125 // channel_support - number of channels supported to encode; 125 // channel_support - number of channels supported to encode;
126 // 1 = mono, 2 = stereo, etc. 126 // 1 = mono, 2 = stereo, etc.
127 // owns_decoder - if true, it means that the codec should own the
128 // decoder instance. In this case, the codec should
129 // implement ACMGenericCodec::Decoder(), which returns
130 // a pointer to AudioDecoder. This pointer is injected
131 // into NetEq when this codec is registered as receive
132 // codec. DEPRECATED.
133 struct CodecSettings { 127 struct CodecSettings {
134 int num_packet_sizes; 128 int num_packet_sizes;
135 int packet_sizes_samples[kMaxNumPacketSize]; 129 int packet_sizes_samples[kMaxNumPacketSize];
136 int basic_block_samples; 130 int basic_block_samples;
137 int channel_support; 131 int channel_support;
138 bool owns_decoder;
139 }; 132 };
140 133
141 // Gets codec information from database at the position in database given by 134 // Gets codec information from database at the position in database given by
142 // [codec_id]. 135 // [codec_id].
143 // Input: 136 // Input:
144 // [codec_id] - number that specifies at what position in the database to 137 // [codec_id] - number that specifies at what position in the database to
145 // get the information. 138 // get the information.
146 // Output: 139 // Output:
147 // [codec_inst] - filled with information about the codec. 140 // [codec_inst] - filled with information about the codec.
148 // Return: 141 // Return:
(...skipping 16 matching lines...) Expand all
165 // database. 158 // database.
166 // TODO(tlegrand): Check if function is needed, or if we can change 159 // TODO(tlegrand): Check if function is needed, or if we can change
167 // to access database directly. 160 // to access database directly.
168 // Input: 161 // Input:
169 // [codec_id] - number that specifies at what position in the database to 162 // [codec_id] - number that specifies at what position in the database to
170 // get the information. 163 // get the information.
171 // Return: 164 // Return:
172 // codec sampling frequency if successful, otherwise -1. 165 // codec sampling frequency if successful, otherwise -1.
173 static int CodecFreq(int codec_id); 166 static int CodecFreq(int codec_id);
174 167
175 // Return the codec's basic coding block size in samples.
176 // TODO(tlegrand): Check if function is needed, or if we can change
177 // to access database directly.
178 // Input:
179 // [codec_id] - number that specifies at what position in the database to
180 // get the information.
181 // Return:
182 // codec basic block size if successful, otherwise -1.
183 static int BasicCodingBlock(int codec_id);
184
185 // Returns the NetEQ decoder database.
186 static const NetEqDecoder* NetEQDecoders();
187
188 // Specifies if the codec specified by |codec_id| MUST own its own decoder.
189 // This is the case for codecs which *should* share a single codec instance
190 // between encoder and decoder. Or for codecs which ACM should have control
191 // over the decoder. For instance iSAC is such a codec that encoder and
192 // decoder share the same codec instance.
193 static bool OwnsDecoder(int codec_id);
194
195 // Checks if the bitrate is valid for the codec.
196 // Input:
197 // [codec_id] - number that specifies codec's position in the database.
198 // [rate] - bitrate to check.
199 // [frame_size_samples] - (used for iLBC) specifies which frame size to go
200 // with the rate.
201 static bool IsRateValid(int codec_id, int rate);
202 static bool IsISACRateValid(int rate);
203 static bool IsILBCRateValid(int rate, int frame_size_samples);
204 static bool IsAMRRateValid(int rate);
205 static bool IsAMRwbRateValid(int rate);
206 static bool IsG7291RateValid(int rate);
207 static bool IsSpeexRateValid(int rate);
208 static bool IsOpusRateValid(int rate);
209
210 // Check if the payload type is valid, meaning that it is in the valid range 168 // Check if the payload type is valid, meaning that it is in the valid range
211 // of 0 to 127. 169 // of 0 to 127.
212 // Input: 170 // Input:
213 // [payload_type] - payload type. 171 // [payload_type] - payload type.
214 static bool ValidPayloadType(int payload_type); 172 static bool ValidPayloadType(int payload_type);
215 173
216 // Databases with information about the supported codecs 174 // Databases with information about the supported codecs
217 // database_ - stored information about all codecs: payload type, name, 175 // database_ - stored information about all codecs: payload type, name,
218 // sampling frequency, packet size in samples, default channel 176 // sampling frequency, packet size in samples, default channel
219 // support, and default rate. 177 // support, and default rate.
220 // codec_settings_ - stored codec settings: number of allowed packet sizes, 178 // codec_settings_ - stored codec settings: number of allowed packet sizes,
221 // a vector with the allowed packet sizes, basic block 179 // a vector with the allowed packet sizes, basic block
222 // samples, and max number of channels that are supported. 180 // samples, and max number of channels that are supported.
223 // neteq_decoders_ - list of supported decoders in NetEQ. 181 // neteq_decoders_ - list of supported decoders in NetEQ.
224 static const CodecInst database_[kMaxNumCodecs]; 182 static const CodecInst database_[kMaxNumCodecs];
225 static const CodecSettings codec_settings_[kMaxNumCodecs]; 183 static const CodecSettings codec_settings_[kMaxNumCodecs];
226 static const NetEqDecoder neteq_decoders_[kMaxNumCodecs]; 184 static const NetEqDecoder neteq_decoders_[kMaxNumCodecs];
227 }; 185 };
228 186
229 } // namespace acm2 187 } // namespace acm2
230 188
231 } // namespace webrtc 189 } // namespace webrtc
232 190
233 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_CODEC_DATABASE_H_ 191 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_CODEC_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698