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

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

Issue 1430043003: Move ACMCodecDB::ValidPayloadType to RentACodec (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 int ACMCodecDB::CodecNumber(const CodecInst& codec_inst) { 237 int ACMCodecDB::CodecNumber(const CodecInst& codec_inst) {
238 // Look for a matching codec in the database. 238 // Look for a matching codec in the database.
239 int codec_id = CodecId(codec_inst); 239 int codec_id = CodecId(codec_inst);
240 240
241 // Checks if we found a matching codec. 241 // Checks if we found a matching codec.
242 if (codec_id == -1) { 242 if (codec_id == -1) {
243 return kInvalidCodec; 243 return kInvalidCodec;
244 } 244 }
245 245
246 // Checks the validity of payload type 246 // Checks the validity of payload type
247 if (!ValidPayloadType(codec_inst.pltype)) { 247 if (!RentACodec::IsPayloadTypeValid(codec_inst.pltype)) {
248 return kInvalidPayloadtype; 248 return kInvalidPayloadtype;
249 } 249 }
250 250
251 // Comfort Noise is special case, packet-size & rate is not checked. 251 // Comfort Noise is special case, packet-size & rate is not checked.
252 if (STR_CASE_CMP(database_[codec_id].plname, "CN") == 0) { 252 if (STR_CASE_CMP(database_[codec_id].plname, "CN") == 0) {
253 return codec_id; 253 return codec_id;
254 } 254 }
255 255
256 // RED is special case, packet-size & rate is not checked. 256 // RED is special case, packet-size & rate is not checked.
257 if (STR_CASE_CMP(database_[codec_id].plname, "red") == 0) { 257 if (STR_CASE_CMP(database_[codec_id].plname, "red") == 0) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 342
343 // Returns the codec sampling frequency for codec with id = "codec_id" in 343 // Returns the codec sampling frequency for codec with id = "codec_id" in
344 // database. 344 // database.
345 int ACMCodecDB::CodecFreq(int codec_id) { 345 int ACMCodecDB::CodecFreq(int codec_id) {
346 const size_t i = static_cast<size_t>(codec_id); 346 const size_t i = static_cast<size_t>(codec_id);
347 const auto db = RentACodec::Database(); 347 const auto db = RentACodec::Database();
348 return i < db.size() ? db[i].plfreq : -1; 348 return i < db.size() ? db[i].plfreq : -1;
349 } 349 }
350 350
351 // Checks if the payload type is in the valid range.
352 bool ACMCodecDB::ValidPayloadType(int payload_type) {
353 return (payload_type >= 0) && (payload_type <= 127);
354 }
355
356 } // namespace acm2 351 } // namespace acm2
357 352
358 } // namespace webrtc 353 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698