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

Side by Side Diff: webrtc/modules/audio_coding/codecs/ilbc/test/iLBC_test.c

Issue 1174813003: Prepare to convert various types to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comments + resync Created 5 years, 6 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 while (((int16_t)fread(data,sizeof(int16_t),frameLen,ifileid))== 159 while (((int16_t)fread(data,sizeof(int16_t),frameLen,ifileid))==
160 frameLen) { 160 frameLen) {
161 161
162 blockcount++; 162 blockcount++;
163 163
164 /* encoding */ 164 /* encoding */
165 165
166 fprintf(stderr, "--- Encoding block %i --- ",blockcount); 166 fprintf(stderr, "--- Encoding block %i --- ",blockcount);
167 len = WebRtcIlbcfix_Encode(Enc_Inst, data, (int16_t)frameLen, encoded_data); 167 len = WebRtcIlbcfix_Encode(Enc_Inst, data, (int16_t)frameLen, encoded_data);
168 if (len < 0) {
169 fprintf(stderr, "Error encoding\n");
170 exit(0);
171 }
168 fprintf(stderr, "\r"); 172 fprintf(stderr, "\r");
169 173
170 /* write byte file */ 174 /* write byte file */
171 175
172 if (fwrite(encoded_data, sizeof(int16_t), 176 if (fwrite(encoded_data, sizeof(int16_t),
173 ((len+1)/sizeof(int16_t)), efileid) != 177 ((len+1)/sizeof(int16_t)), efileid) !=
174 (size_t)(((len+1)/sizeof(int16_t)))) { 178 (size_t)(((len+1)/sizeof(int16_t)))) {
175 return -1; 179 return -1;
176 } 180 }
177 181
(...skipping 17 matching lines...) Expand all
195 } else { 199 } else {
196 pli=1; 200 pli=1;
197 } 201 }
198 202
199 /* decoding */ 203 /* decoding */
200 204
201 fprintf(stderr, "--- Decoding block %i --- ",blockcount); 205 fprintf(stderr, "--- Decoding block %i --- ",blockcount);
202 if (pli==1) { 206 if (pli==1) {
203 len=WebRtcIlbcfix_Decode(Dec_Inst, encoded_data, 207 len=WebRtcIlbcfix_Decode(Dec_Inst, encoded_data,
204 (int16_t)len, decoded_data,&speechType); 208 (int16_t)len, decoded_data,&speechType);
209 if (len < 0) {
210 fprintf(stderr, "Error decoding\n");
211 exit(0);
212 }
205 } else { 213 } else {
206 len=WebRtcIlbcfix_DecodePlc(Dec_Inst, decoded_data, 1); 214 len=WebRtcIlbcfix_DecodePlc(Dec_Inst, decoded_data, 1);
207 } 215 }
208 fprintf(stderr, "\r"); 216 fprintf(stderr, "\r");
209 217
210 /* write output file */ 218 /* write output file */
211 219
212 if (fwrite(decoded_data, sizeof(int16_t), len, 220 if (fwrite(decoded_data, sizeof(int16_t), len,
213 ofileid) != (size_t)len) { 221 ofileid) != (size_t)len) {
214 return -1; 222 return -1;
215 } 223 }
216 } 224 }
217 225
218 /* close files */ 226 /* close files */
219 227
220 fclose(ifileid); fclose(efileid); fclose(ofileid); 228 fclose(ifileid); fclose(efileid); fclose(ofileid);
221 if (argc==6) { 229 if (argc==6) {
222 fclose(cfileid); 230 fclose(cfileid);
223 } 231 }
224 232
225 /* Free structs */ 233 /* Free structs */
226 WebRtcIlbcfix_EncoderFree(Enc_Inst); 234 WebRtcIlbcfix_EncoderFree(Enc_Inst);
227 WebRtcIlbcfix_DecoderFree(Dec_Inst); 235 WebRtcIlbcfix_DecoderFree(Dec_Inst);
228 236
229 237
230 printf("\nDone with simulation\n\n"); 238 printf("\nDone with simulation\n\n");
231 239
232 return(0); 240 return(0);
233 } 241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698