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

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module.cc

Issue 1316523002: Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix compile Created 4 years, 11 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 auto ci = acm2::RentACodec::CodecInstById(*codec_id); 49 auto ci = acm2::RentACodec::CodecInstById(*codec_id);
50 if (!ci) 50 if (!ci)
51 return -1; 51 return -1;
52 *codec = *ci; 52 *codec = *ci;
53 return 0; 53 return 0;
54 } 54 }
55 55
56 int AudioCodingModule::Codec(const char* payload_name, 56 int AudioCodingModule::Codec(const char* payload_name,
57 CodecInst* codec, 57 CodecInst* codec,
58 int sampling_freq_hz, 58 int sampling_freq_hz,
59 int channels) { 59 size_t channels) {
60 rtc::Optional<CodecInst> ci = acm2::RentACodec::CodecInstByParams( 60 rtc::Optional<CodecInst> ci = acm2::RentACodec::CodecInstByParams(
61 payload_name, sampling_freq_hz, channels); 61 payload_name, sampling_freq_hz, channels);
62 if (ci) { 62 if (ci) {
63 *codec = *ci; 63 *codec = *ci;
64 return 0; 64 return 0;
65 } else { 65 } else {
66 // We couldn't find a matching codec, so set the parameters to unacceptable 66 // We couldn't find a matching codec, so set the parameters to unacceptable
67 // values and return. 67 // values and return.
68 codec->plname[0] = '\0'; 68 codec->plname[0] = '\0';
69 codec->pltype = -1; 69 codec->pltype = -1;
70 codec->pacsize = 0; 70 codec->pacsize = 0;
71 codec->rate = 0; 71 codec->rate = 0;
72 codec->plfreq = 0; 72 codec->plfreq = 0;
73 return -1; 73 return -1;
74 } 74 }
75 } 75 }
76 76
77 int AudioCodingModule::Codec(const char* payload_name, 77 int AudioCodingModule::Codec(const char* payload_name,
78 int sampling_freq_hz, 78 int sampling_freq_hz,
79 int channels) { 79 size_t channels) {
80 rtc::Optional<acm2::RentACodec::CodecId> ci = 80 rtc::Optional<acm2::RentACodec::CodecId> ci =
81 acm2::RentACodec::CodecIdByParams(payload_name, sampling_freq_hz, 81 acm2::RentACodec::CodecIdByParams(payload_name, sampling_freq_hz,
82 channels); 82 channels);
83 if (!ci) 83 if (!ci)
84 return -1; 84 return -1;
85 rtc::Optional<int> i = acm2::RentACodec::CodecIndexFromId(*ci); 85 rtc::Optional<int> i = acm2::RentACodec::CodecIndexFromId(*ci);
86 return i ? *i : -1; 86 return i ? *i : -1;
87 } 87 }
88 88
89 // Checks the validity of the parameters of the given codec 89 // Checks the validity of the parameters of the given codec
90 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) { 90 bool AudioCodingModule::IsCodecValid(const CodecInst& codec) {
91 bool valid = acm2::RentACodec::IsCodecValid(codec); 91 bool valid = acm2::RentACodec::IsCodecValid(codec);
92 if (!valid) 92 if (!valid)
93 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1, 93 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, -1,
94 "Invalid codec setting"); 94 "Invalid codec setting");
95 return valid; 95 return valid;
96 } 96 }
97 97
98 } // namespace webrtc 98 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/acm2/acm_resampler.cc ('k') | webrtc/modules/audio_coding/acm2/audio_coding_module_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698