OLD | NEW |
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // Looks for a matching payload name, frequency, and channels in the | 285 // Looks for a matching payload name, frequency, and channels in the |
286 // codec list. Need to check all three since some codecs have several codec | 286 // codec list. Need to check all three since some codecs have several codec |
287 // entries with different frequencies and/or channels. | 287 // entries with different frequencies and/or channels. |
288 // Does not check other codec settings, such as payload type and packet size. | 288 // Does not check other codec settings, such as payload type and packet size. |
289 // Returns the id of the codec, or -1 if no match is found. | 289 // Returns the id of the codec, or -1 if no match is found. |
290 int ACMCodecDB::CodecId(const CodecInst& codec_inst) { | 290 int ACMCodecDB::CodecId(const CodecInst& codec_inst) { |
291 return (CodecId(codec_inst.plname, codec_inst.plfreq, | 291 return (CodecId(codec_inst.plname, codec_inst.plfreq, |
292 codec_inst.channels)); | 292 codec_inst.channels)); |
293 } | 293 } |
294 | 294 |
295 int ACMCodecDB::CodecId(const char* payload_name, int frequency, int channels) { | 295 int ACMCodecDB::CodecId(const char* payload_name, |
| 296 int frequency, |
| 297 size_t channels) { |
296 for (const CodecInst& ci : RentACodec::Database()) { | 298 for (const CodecInst& ci : RentACodec::Database()) { |
297 bool name_match = false; | 299 bool name_match = false; |
298 bool frequency_match = false; | 300 bool frequency_match = false; |
299 bool channels_match = false; | 301 bool channels_match = false; |
300 | 302 |
301 // Payload name, sampling frequency and number of channels need to match. | 303 // Payload name, sampling frequency and number of channels need to match. |
302 // NOTE! If |frequency| is -1, the frequency is not applicable, and is | 304 // NOTE! If |frequency| is -1, the frequency is not applicable, and is |
303 // always treated as true, like for RED. | 305 // always treated as true, like for RED. |
304 name_match = (STR_CASE_CMP(ci.plname, payload_name) == 0); | 306 name_match = (STR_CASE_CMP(ci.plname, payload_name) == 0); |
305 frequency_match = (frequency == ci.plfreq) || (frequency == -1); | 307 frequency_match = (frequency == ci.plfreq) || (frequency == -1); |
(...skipping 16 matching lines...) Expand all Loading... |
322 } | 324 } |
323 // Gets codec id number from database for the receiver. | 325 // Gets codec id number from database for the receiver. |
324 int ACMCodecDB::ReceiverCodecNumber(const CodecInst& codec_inst) { | 326 int ACMCodecDB::ReceiverCodecNumber(const CodecInst& codec_inst) { |
325 // Look for a matching codec in the database. | 327 // Look for a matching codec in the database. |
326 return CodecId(codec_inst); | 328 return CodecId(codec_inst); |
327 } | 329 } |
328 | 330 |
329 } // namespace acm2 | 331 } // namespace acm2 |
330 | 332 |
331 } // namespace webrtc | 333 } // namespace webrtc |
OLD | NEW |