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

Unified Diff: webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c b/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c
index 71bd272f9cfdb617cc72ce5b76f0c7b61ab1a8d3..b82af1c05914bc02bb638bbe6681dec76851d7bd 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c
@@ -21,6 +21,7 @@
/* include API */
#include "isac.h"
#include "isacfix.h"
+#include "webrtc/base/format_macros.h"
/* max number of samples per frame (= 60 ms frame) */
#define MAX_FRAMESAMPLES 960
@@ -57,7 +58,7 @@ typedef struct {
} BottleNeckModel;
void get_arrival_time(int current_framesamples, /* samples */
- int packet_size, /* bytes */
+ size_t packet_size, /* bytes */
int bottleneck, /* excluding headers; bits/s */
BottleNeckModel* BN_data) {
const int HeaderSize = 35;
@@ -98,7 +99,7 @@ int main(int argc, char* argv[]) {
double runtime;
double length_file;
- int16_t stream_len = 0;
+ size_t stream_len = 0;
int declen;
int16_t shortdata[FRAMESAMPLES_10ms];
@@ -114,7 +115,7 @@ int main(int argc, char* argv[]) {
#ifdef _DEBUG
FILE* fy;
double kbps;
- int totalbits = 0;
+ size_t totalbits = 0;
int totalsmpls = 0;
#endif /* _DEBUG */
@@ -392,6 +393,8 @@ int main(int argc, char* argv[]) {
while (endfile == 0) {
cur_framesmpls = 0;
while (1) {
+ int stream_len_int;
+
/* Read 10 ms speech block */
if (nbTest != 1)
endfile = readframe(shortdata, inp, FRAMESAMPLES_10ms);
@@ -401,9 +404,9 @@ int main(int argc, char* argv[]) {
/* iSAC encoding */
if (mode == 0 || mode == 1) {
- stream_len =
+ stream_len_int =
WebRtcIsac_Encode(ISAC_main_inst, shortdata, (uint8_t*)streamdata);
- if (stream_len < 0) {
+ if (stream_len_int < 0) {
/* exit if returned with error */
errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst);
printf("\n\nError in encoder: %d.\n\n", errtype);
@@ -412,20 +415,21 @@ int main(int argc, char* argv[]) {
} else if (mode == 2 || mode == 3) {
/* iSAC encoding */
if (nbTest != 1) {
- stream_len = WebRtcIsacfix_Encode(ISACFIX_main_inst, shortdata,
- (uint8_t*)streamdata);
+ stream_len_int = WebRtcIsacfix_Encode(ISACFIX_main_inst, shortdata,
+ (uint8_t*)streamdata);
} else {
- stream_len =
+ stream_len_int =
WebRtcIsacfix_EncodeNb(ISACFIX_main_inst, shortdata, streamdata);
}
- if (stream_len < 0) {
+ if (stream_len_int < 0) {
/* exit if returned with error */
errtype = WebRtcIsacfix_GetErrorCode(ISACFIX_main_inst);
printf("\n\nError in encoder: %d.\n\n", errtype);
// exit(EXIT_FAILURE);
}
}
+ stream_len = (size_t)stream_len_int;
cur_framesmpls += FRAMESAMPLES_10ms;
@@ -494,10 +498,13 @@ int main(int argc, char* argv[]) {
/* iSAC decoding */
if (plc && (framecnt + 1) % 10 == 0) {
- if (nbTest != 2)
- declen = WebRtcIsacfix_DecodePlc(ISACFIX_main_inst, decoded, 1);
- else
- declen = WebRtcIsacfix_DecodePlcNb(ISACFIX_main_inst, decoded, 1);
+ if (nbTest != 2) {
+ declen =
+ (int)WebRtcIsacfix_DecodePlc(ISACFIX_main_inst, decoded, 1);
+ } else {
+ declen =
+ (int)WebRtcIsacfix_DecodePlcNb(ISACFIX_main_inst, decoded, 1);
+ }
} else {
if (nbTest != 2)
declen = WebRtcIsacfix_Decode(ISACFIX_main_inst, streamdata,
@@ -551,10 +558,13 @@ int main(int argc, char* argv[]) {
/* iSAC decoding */
if (plc && (framecnt + 1) % 10 == 0) {
- if (nbTest != 2)
- declen = WebRtcIsacfix_DecodePlc(ISACFIX_main_inst, decoded, 1);
- else
- declen = WebRtcIsacfix_DecodePlcNb(ISACFIX_main_inst, decoded, 1);
+ if (nbTest != 2) {
+ declen =
+ (int)WebRtcIsacfix_DecodePlc(ISACFIX_main_inst, decoded, 1);
+ } else {
+ declen =
+ (int)WebRtcIsacfix_DecodePlcNb(ISACFIX_main_inst, decoded, 1);
+ }
} else {
if (nbTest != 2) {
declen = WebRtcIsacfix_Decode(ISACFIX_main_inst, streamdata,
@@ -592,7 +602,7 @@ int main(int argc, char* argv[]) {
}
#ifdef _DEBUG
- printf("\n\ntotal bits = %d bits", totalbits);
+ printf("\n\ntotal bits = %" PRIuS " bits", totalbits);
printf("\nmeasured average bitrate = %0.3f kbits/s",
(double)totalbits * (FS / 1000) / totalsmpls);
printf("\n");

Powered by Google App Engine
This is Rietveld 408576698