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

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

Issue 1423043005: Remove ACMCodecDB::Codec, and make the rest of ACMCodecDB private (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@rac3
Patch Set: rebase Created 5 years, 1 month 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 NetEqDecoder::kDecoderCNGswb32kHz, 202 NetEqDecoder::kDecoderCNGswb32kHz,
203 #ifdef ENABLE_48000_HZ 203 #ifdef ENABLE_48000_HZ
204 NetEqDecoder::kDecoderCNGswb48kHz, 204 NetEqDecoder::kDecoderCNGswb48kHz,
205 #endif 205 #endif
206 NetEqDecoder::kDecoderAVT, 206 NetEqDecoder::kDecoderAVT,
207 #ifdef WEBRTC_CODEC_RED 207 #ifdef WEBRTC_CODEC_RED
208 NetEqDecoder::kDecoderRED, 208 NetEqDecoder::kDecoderRED,
209 #endif 209 #endif
210 }; 210 };
211 211
212 // Get codec information from database.
213 // TODO(tlegrand): replace memcpy with a pointer to the data base memory.
214 int ACMCodecDB::Codec(int codec_id, CodecInst* codec_inst) {
215 // Error check to see that codec_id is not out of bounds.
216 if (static_cast<size_t>(codec_id) >= RentACodec::NumberOfCodecs()) {
217 return -1;
218 }
219
220 // Copy database information for the codec to the output.
221 memcpy(codec_inst, &database_[codec_id], sizeof(CodecInst));
222
223 return 0;
224 }
225
226 // Enumerator for error codes when asking for codec database id. 212 // Enumerator for error codes when asking for codec database id.
227 enum { 213 enum {
228 kInvalidCodec = -10, 214 kInvalidCodec = -10,
229 kInvalidPayloadtype = -30, 215 kInvalidPayloadtype = -30,
230 kInvalidPacketSize = -40, 216 kInvalidPacketSize = -40,
231 kInvalidRate = -50 217 kInvalidRate = -50
232 }; 218 };
233 219
234 // Gets the codec id number from the database. If there is some mismatch in 220 // Gets the codec id number from the database. If there is some mismatch in
235 // the codec settings, the function will return an error code. 221 // the codec settings, the function will return an error code.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 322 }
337 // Gets codec id number from database for the receiver. 323 // Gets codec id number from database for the receiver.
338 int ACMCodecDB::ReceiverCodecNumber(const CodecInst& codec_inst) { 324 int ACMCodecDB::ReceiverCodecNumber(const CodecInst& codec_inst) {
339 // Look for a matching codec in the database. 325 // Look for a matching codec in the database.
340 return CodecId(codec_inst); 326 return CodecId(codec_inst);
341 } 327 }
342 328
343 } // namespace acm2 329 } // namespace acm2
344 330
345 } // namespace webrtc 331 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698