Fixed GCC 4.6 errors (mostly 'unused variable' errors and incorrect usage of EXPECT_EQ with booleans.
Fixed remaining compilation errors in release, etc. Fixed errors from GCC 4.6 compilation. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/366008 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1554 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
42ae41e5a2
commit
d1a860b415
@ -24,8 +24,8 @@
|
||||
|
||||
/* Defines */
|
||||
#define SEED_FILE "randseed.txt" /* Used when running decoder on garbage data */
|
||||
#define MAX_FRAMESAMPLES 960 /* max number of samples per frame
|
||||
(= 60 ms frame & 16 kHz) or
|
||||
#define MAX_FRAMESAMPLES 960 /* max number of samples per frame
|
||||
(= 60 ms frame & 16 kHz) or
|
||||
(= 30 ms frame & 32 kHz) */
|
||||
#define FRAMESAMPLES_10ms 160 /* number of samples per 10ms frame */
|
||||
#define SWBFRAMESAMPLES_10ms 320
|
||||
@ -43,7 +43,7 @@ using namespace std;
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
char inname[100], outname[100], bottleneck_file[100], vadfile[100];
|
||||
char inname[100], outname[100], bottleneck_file[100], vadfile[100];
|
||||
FILE *inp, *outp, *f_bn=NULL, *vadp, *bandwidthp;
|
||||
int framecnt, endfile;
|
||||
|
||||
@ -52,14 +52,13 @@ int main(int argc, char* argv[])
|
||||
WebRtc_Word32 bottleneck;
|
||||
WebRtc_Word16 framesize = 30; /* ms */
|
||||
int cur_framesmpls, err;
|
||||
int testCE=0;
|
||||
|
||||
/* Runtime statistics */
|
||||
double starttime, runtime, length_file;
|
||||
|
||||
WebRtc_Word16 stream_len = 0;
|
||||
WebRtc_Word16 declen, lostFrame = 0, declenTC = 0;
|
||||
|
||||
|
||||
WebRtc_Word16 shortdata[SWBFRAMESAMPLES_10ms];
|
||||
WebRtc_Word16 vaddata[SWBFRAMESAMPLES_10ms*3];
|
||||
WebRtc_Word16 decoded[MAX_FRAMESAMPLES << 1];
|
||||
@ -67,13 +66,12 @@ int main(int argc, char* argv[])
|
||||
WebRtc_UWord16 streamdata[500];
|
||||
WebRtc_Word16 speechType[1];
|
||||
WebRtc_Word16 rateBPS = 0;
|
||||
WebRtc_Word16 fixedFL = 0;
|
||||
WebRtc_Word16 fixedFL = 0;
|
||||
WebRtc_Word16 payloadSize = 0;
|
||||
WebRtc_Word32 payloadRate = 0;
|
||||
int setControlBWE = 0;
|
||||
short FL, testNum;
|
||||
char version_number[20];
|
||||
int readLoss;
|
||||
FILE *plFile;
|
||||
WebRtc_Word32 sendBN;
|
||||
|
||||
@ -86,7 +84,6 @@ int main(int argc, char* argv[])
|
||||
|
||||
/* If use GNS file */
|
||||
FILE *fp_gns = NULL;
|
||||
int gns = 0;
|
||||
char gns_file[100];
|
||||
short maxStreamLen30 = 0;
|
||||
short maxStreamLen60 = 0;
|
||||
@ -131,7 +128,7 @@ int main(int argc, char* argv[])
|
||||
printf("[-I] : if -I option is specified, the coder will use\n");
|
||||
printf(" an instantaneous Bottleneck value. If not, it\n");
|
||||
printf(" will be an adaptive Bottleneck value.\n\n");
|
||||
printf("[-assign] : Use Assign API.\n");
|
||||
printf("[-assign] : Use Assign API.\n");
|
||||
printf("[-B num] : the value of the bottleneck provided either\n");
|
||||
printf(" as a fixed value in bits/sec (e.g. 25000) or\n");
|
||||
printf(" read from a file (e.g. bottleneck.txt)\n\n");
|
||||
@ -163,14 +160,14 @@ int main(int argc, char* argv[])
|
||||
printf(" the output file is written to 'file'\n");
|
||||
printf("[-LOOP num] : number of times to repeat coding the input file for stress testing\n");
|
||||
//printf("[-CE num] : Test of APIs used by Conference Engine.\n");
|
||||
//printf(" CE 1 - getNewBitstream, getBWE \n");
|
||||
//printf(" CE 1 - getNewBitstream, getBWE \n");
|
||||
//printf(" (CE 2 - RESERVED for transcoding)\n");
|
||||
//printf(" CE 3 - getSendBWE, setSendBWE. \n\n");
|
||||
//printf(" CE 3 - getSendBWE, setSendBWE. \n\n");
|
||||
//printf("-L filename : write the logging info into file (appending)\n");
|
||||
printf("infile : Normal speech input file\n\n");
|
||||
printf("outfile : Speech output file\n\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Print version number */
|
||||
printf("-------------------------------------------------\n");
|
||||
@ -180,13 +177,12 @@ int main(int argc, char* argv[])
|
||||
/* Loop over all command line arguments */
|
||||
CodingMode = 0;
|
||||
testNum = 0;
|
||||
testCE = 0;
|
||||
useAssign = 0;
|
||||
//logFile = NULL;
|
||||
char transCodingFileName[500];
|
||||
WebRtc_Word16 totFileLoop = 0;
|
||||
WebRtc_Word16 numFileLoop = 0;
|
||||
for (i = 1; i < argc-2;i++)
|
||||
for (i = 1; i < argc-2;i++)
|
||||
{
|
||||
if(!strcmp("-LOOP", argv[i]))
|
||||
{
|
||||
@ -222,17 +218,17 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
/* Instantaneous mode */
|
||||
if(!strcmp ("-I", argv[i]))
|
||||
if(!strcmp ("-I", argv[i]))
|
||||
{
|
||||
printf("Instantaneous BottleNeck\n");
|
||||
CodingMode = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Set (initial) bottleneck value */
|
||||
if(!strcmp ("-INITRATE", argv[i])) {
|
||||
rateBPS = atoi(argv[i + 1]);
|
||||
setControlBWE = 1;
|
||||
if((rateBPS < 10000) || (rateBPS > 32000))
|
||||
if((rateBPS < 10000) || (rateBPS > 32000))
|
||||
{
|
||||
printf("\n%d is not a initial rate. Valid values are in the range 10000 to 32000.\n", rateBPS);
|
||||
exit(0);
|
||||
@ -240,11 +236,11 @@ int main(int argc, char* argv[])
|
||||
printf("New initial rate: %d\n", rateBPS);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
/* Set (initial) framelength */
|
||||
if(!strcmp ("-FL", argv[i])) {
|
||||
framesize = atoi(argv[i + 1]);
|
||||
if((framesize != 30) && (framesize != 60))
|
||||
if((framesize != 30) && (framesize != 60))
|
||||
{
|
||||
printf("\n%d is not a valid frame length. Valid length are 30 and 60 msec.\n", framesize);
|
||||
exit(0);
|
||||
@ -253,15 +249,15 @@ int main(int argc, char* argv[])
|
||||
printf("Frame Length: %d\n", framesize);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
/* Fixed frame length */
|
||||
if(!strcmp ("-FIXED_FL", argv[i]))
|
||||
if(!strcmp ("-FIXED_FL", argv[i]))
|
||||
{
|
||||
fixedFL = 1;
|
||||
setControlBWE = 1;
|
||||
printf("Fixed Frame Length\n");
|
||||
}
|
||||
|
||||
|
||||
/* Set maximum allowed payload size in bytes */
|
||||
if(!strcmp ("-MAX", argv[i])) {
|
||||
payloadSize = atoi(argv[i + 1]);
|
||||
@ -277,71 +273,68 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
/* Test of fault scenarious */
|
||||
if(!strcmp ("-F", argv[i]))
|
||||
if(!strcmp ("-F", argv[i]))
|
||||
{
|
||||
testNum = atoi(argv[i + 1]);
|
||||
printf("Fault test: %d\n", testNum);
|
||||
if(testNum < 1 || testNum > 10)
|
||||
if(testNum < 1 || testNum > 10)
|
||||
{
|
||||
printf("\n%d is not a valid Fault Scenario number. Valid Fault Scenarios are numbered 1-10.\n", testNum);
|
||||
exit(0);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
/* Packet loss test */
|
||||
if(!strcmp ("-PL", argv[i]))
|
||||
if(!strcmp ("-PL", argv[i]))
|
||||
{
|
||||
if( isdigit( *argv[i+1] ) )
|
||||
if( isdigit( *argv[i+1] ) )
|
||||
{
|
||||
packetLossPercent = atoi( argv[i+1] );
|
||||
if( (packetLossPercent < 0) | (packetLossPercent > 100) )
|
||||
if( (packetLossPercent < 0) | (packetLossPercent > 100) )
|
||||
{
|
||||
printf( "\nInvalid packet loss perentage \n" );
|
||||
exit( 0 );
|
||||
}
|
||||
if( packetLossPercent > 0 )
|
||||
if( packetLossPercent > 0 )
|
||||
{
|
||||
printf( "Simulating %d %% of independent packet loss\n", packetLossPercent );
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "\nNo Packet Loss Is Simulated \n" );
|
||||
}
|
||||
readLoss = 0;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
readLoss = 1;
|
||||
plFile = fopen( argv[i+1], "rb" );
|
||||
if( plFile == NULL )
|
||||
if( plFile == NULL )
|
||||
{
|
||||
printf( "\n couldn't open the frameloss file: %s\n", argv[i+1] );
|
||||
exit( 0 );
|
||||
}
|
||||
printf( "Simulating packet loss through the given channel file: %s\n", argv[i+1] );
|
||||
printf( "Simulating packet loss through the given channel file: %s\n", argv[i+1] );
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Random packetlosses */
|
||||
if(!strcmp ("-rnd", argv[i]))
|
||||
if(!strcmp ("-rnd", argv[i]))
|
||||
{
|
||||
srand((unsigned int)time(NULL) );
|
||||
srand((unsigned int)time(NULL) );
|
||||
printf( "Random pattern in lossed packets \n" );
|
||||
}
|
||||
|
||||
/* Use gns file */
|
||||
if(!strcmp ("-G", argv[i]))
|
||||
if(!strcmp ("-G", argv[i]))
|
||||
{
|
||||
sscanf(argv[i + 1], "%s", gns_file);
|
||||
fp_gns = fopen(gns_file, "rb");
|
||||
if(fp_gns == NULL)
|
||||
if(fp_gns == NULL)
|
||||
{
|
||||
printf("Cannot read file %s.\n", gns_file);
|
||||
exit(0);
|
||||
}
|
||||
gns = 1;
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -361,7 +354,7 @@ int main(int argc, char* argv[])
|
||||
printf("Error No value provided for BottleNeck and cannot read file %s.\n", bottleneck_file);
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
printf("reading bottleneck rates from file %s\n\n",bottleneck_file);
|
||||
if(fscanf(f_bn, "%d", &bottleneck) == EOF)
|
||||
@ -371,9 +364,9 @@ int main(int argc, char* argv[])
|
||||
if (fscanf(f_bn, "%d", &bottleneck) == EOF) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Bottleneck is a cosine function
|
||||
/* Bottleneck is a cosine function
|
||||
* Matlab code for writing the bottleneck file:
|
||||
* BottleNeck_10ms = 20e3 + 10e3 * cos((0:5999)/5999*2*pi);
|
||||
* fid = fopen('bottleneck.txt', 'wb');
|
||||
@ -381,7 +374,7 @@ int main(int argc, char* argv[])
|
||||
*/
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
printf("\nfixed bottleneck rate of %d bits/s\n\n", bottleneck);
|
||||
}
|
||||
@ -392,17 +385,17 @@ int main(int argc, char* argv[])
|
||||
// if(!strcmp ("-CE", argv[i]))
|
||||
// {
|
||||
// testCE = atoi(argv[i + 1]);
|
||||
// if(testCE==1)
|
||||
// if(testCE==1)
|
||||
// {
|
||||
// i++;
|
||||
// scale = (float)atof( argv[i+1] );
|
||||
// }
|
||||
// else if(testCE == 2)
|
||||
// }
|
||||
// else if(testCE == 2)
|
||||
// {
|
||||
// printf("\nCE-test 2 (transcoding) not implemented.\n");
|
||||
// exit(0);
|
||||
// }
|
||||
// else if(testCE < 1 || testCE > 3)
|
||||
// }
|
||||
// else if(testCE < 1 || testCE > 3)
|
||||
// {
|
||||
// printf("\n%d is not a valid CE-test number. Valid CE tests are 1-3.\n", testCE);
|
||||
// exit(0);
|
||||
@ -444,23 +437,23 @@ int main(int argc, char* argv[])
|
||||
sscanf(argv[argc-1], "%s", outname);
|
||||
printf("\nInput file: %s\n", inname);
|
||||
printf("Output file: %s\n\n", outname);
|
||||
if((inp = fopen(inname,"rb")) == NULL)
|
||||
if((inp = fopen(inname,"rb")) == NULL)
|
||||
{
|
||||
printf(" Error iSAC Cannot read file %s.\n", inname);
|
||||
cout << flush;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if((outp = fopen(outname,"wb")) == NULL)
|
||||
if((outp = fopen(outname,"wb")) == NULL)
|
||||
{
|
||||
printf(" Error iSAC Cannot write file %s.\n", outname);
|
||||
cout << flush;
|
||||
getchar();
|
||||
exit(1);
|
||||
}
|
||||
if(VADusage)
|
||||
if(VADusage)
|
||||
{
|
||||
if((vadp = fopen(vadfile,"rb")) == NULL)
|
||||
if((vadp = fopen(vadfile,"rb")) == NULL)
|
||||
{
|
||||
printf(" Error iSAC Cannot read file %s.\n", vadfile);
|
||||
cout << flush;
|
||||
@ -468,7 +461,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if((bandwidthp = fopen("bwe.pcm","wb")) == NULL)
|
||||
if((bandwidthp = fopen("bwe.pcm","wb")) == NULL)
|
||||
{
|
||||
printf(" Error iSAC Cannot read file %s.\n", "bwe.pcm");
|
||||
cout << flush;
|
||||
@ -484,7 +477,7 @@ int main(int argc, char* argv[])
|
||||
if(!useAssign)
|
||||
{
|
||||
err =WebRtcIsac_Create(&ISAC_main_inst);
|
||||
WebRtcIsac_SetEncSampRate(ISAC_main_inst, (sampFreqKHz == 16)? kIsacWideband:kIsacSuperWideband);
|
||||
WebRtcIsac_SetEncSampRate(ISAC_main_inst, (sampFreqKHz == 16)? kIsacWideband:kIsacSuperWideband);
|
||||
WebRtcIsac_SetDecSampRate(ISAC_main_inst, (sampFreqKHz == 16)? kIsacWideband:kIsacSuperWideband);
|
||||
}
|
||||
else
|
||||
@ -492,14 +485,14 @@ int main(int argc, char* argv[])
|
||||
/* Test the Assign functions */
|
||||
int sss;
|
||||
void *ppp;
|
||||
err = WebRtcIsac_AssignSize(&sss);
|
||||
err = WebRtcIsac_AssignSize(&sss);
|
||||
ppp = malloc(sss);
|
||||
err = WebRtcIsac_Assign(&ISAC_main_inst, ppp);
|
||||
WebRtcIsac_SetEncSampRate(ISAC_main_inst, (sampFreqKHz == 16)? kIsacWideband:kIsacSuperWideband);
|
||||
err = WebRtcIsac_Assign(&ISAC_main_inst, ppp);
|
||||
WebRtcIsac_SetEncSampRate(ISAC_main_inst, (sampFreqKHz == 16)? kIsacWideband:kIsacSuperWideband);
|
||||
WebRtcIsac_SetDecSampRate(ISAC_main_inst, (sampFreqKHz == 16)? kIsacWideband:kIsacSuperWideband);
|
||||
}
|
||||
/* Error check */
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
printf("\n\n Error in create.\n\n");
|
||||
cout << flush;
|
||||
@ -513,11 +506,11 @@ int main(int argc, char* argv[])
|
||||
/* Initialize encoder and decoder */
|
||||
framecnt= 0;
|
||||
endfile = 0;
|
||||
|
||||
|
||||
if(doTransCoding)
|
||||
{
|
||||
WebRtcIsac_Create(&decoderTransCoding);
|
||||
WebRtcIsac_SetEncSampRate(decoderTransCoding, (sampFreqKHz == 16)? kIsacWideband:kIsacSuperWideband);
|
||||
WebRtcIsac_Create(&decoderTransCoding);
|
||||
WebRtcIsac_SetEncSampRate(decoderTransCoding, (sampFreqKHz == 16)? kIsacWideband:kIsacSuperWideband);
|
||||
WebRtcIsac_SetDecSampRate(decoderTransCoding, (sampFreqKHz == 16)? kIsacWideband:kIsacSuperWideband);
|
||||
WebRtcIsac_DecoderInit(decoderTransCoding);
|
||||
transCodingFile = fopen(transCodingFileName, "wb");
|
||||
@ -535,7 +528,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if(testNum != 1)
|
||||
if(testNum != 1)
|
||||
{
|
||||
if(WebRtcIsac_EncoderInit(ISAC_main_inst, CodingMode) < 0)
|
||||
{
|
||||
@ -544,19 +537,19 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(testNum != 2)
|
||||
if(testNum != 2)
|
||||
{
|
||||
if(WebRtcIsac_DecoderInit(ISAC_main_inst) < 0)
|
||||
if(WebRtcIsac_DecoderInit(ISAC_main_inst) < 0)
|
||||
{
|
||||
printf("Error could not initialize the decoder \n");
|
||||
cout << flush;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(CodingMode == 1)
|
||||
}
|
||||
if(CodingMode == 1)
|
||||
{
|
||||
err = WebRtcIsac_Control(ISAC_main_inst, bottleneck, framesize);
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
/* exit if returned with error */
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
@ -569,24 +562,24 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if((setControlBWE) && (CodingMode == 0))
|
||||
if((setControlBWE) && (CodingMode == 0))
|
||||
{
|
||||
err = WebRtcIsac_ControlBwe(ISAC_main_inst, rateBPS, framesize, fixedFL);
|
||||
if(err < 0)
|
||||
err = WebRtcIsac_ControlBwe(ISAC_main_inst, rateBPS, framesize, fixedFL);
|
||||
if(err < 0)
|
||||
{
|
||||
/* exit if returned with error */
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
|
||||
|
||||
printf("\n\n Error in Control BWE: %d.\n\n", errtype);
|
||||
cout << flush;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if(payloadSize != 0)
|
||||
if(payloadSize != 0)
|
||||
{
|
||||
err = WebRtcIsac_SetMaxPayloadSize(ISAC_main_inst, payloadSize);
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
/* exit if returned with error */
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
@ -595,10 +588,10 @@ int main(int argc, char* argv[])
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if(payloadRate != 0)
|
||||
if(payloadRate != 0)
|
||||
{
|
||||
err = WebRtcIsac_SetMaxRate(ISAC_main_inst, payloadRate);
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
/* exit if returned with error */
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
@ -615,23 +608,23 @@ int main(int argc, char* argv[])
|
||||
length_file = 0;
|
||||
WebRtc_Word16 bnIdxTC;
|
||||
WebRtc_Word16 jitterInfoTC;
|
||||
while (endfile == 0)
|
||||
{
|
||||
while (endfile == 0)
|
||||
{
|
||||
/* Call init functions at random, fault test number 7 */
|
||||
if(testNum == 7 && (rand()%2 == 0))
|
||||
if(testNum == 7 && (rand()%2 == 0))
|
||||
{
|
||||
err = WebRtcIsac_EncoderInit(ISAC_main_inst, CodingMode);
|
||||
/* Error check */
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
printf("\n\n Error in encoderinit: %d.\n\n", errtype);
|
||||
cout << flush;
|
||||
}
|
||||
|
||||
err = WebRtcIsac_DecoderInit(ISAC_main_inst);
|
||||
err = WebRtcIsac_DecoderInit(ISAC_main_inst);
|
||||
/* Error check */
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
printf("\n\n Error in decoderinit: %d.\n\n", errtype);
|
||||
@ -640,10 +633,8 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
cur_framesmpls = 0;
|
||||
while (1)
|
||||
while (1)
|
||||
{
|
||||
int kkk;
|
||||
|
||||
/* Read 10 ms speech block */
|
||||
endfile = readframe(shortdata, inp, samplesIn10Ms);
|
||||
|
||||
@ -658,19 +649,19 @@ int main(int argc, char* argv[])
|
||||
endfile = readframe(shortdata, inp, samplesIn10Ms);
|
||||
}
|
||||
}
|
||||
|
||||
if(testNum == 7)
|
||||
|
||||
if(testNum == 7)
|
||||
{
|
||||
srand((unsigned int)time(NULL));
|
||||
}
|
||||
|
||||
/* iSAC encoding */
|
||||
if(!(testNum == 3 && framecnt == 0))
|
||||
if(!(testNum == 3 && framecnt == 0))
|
||||
{
|
||||
stream_len = WebRtcIsac_Encode(ISAC_main_inst,
|
||||
stream_len = WebRtcIsac_Encode(ISAC_main_inst,
|
||||
shortdata,
|
||||
(WebRtc_Word16*)streamdata);
|
||||
if((payloadSize != 0) && (stream_len > payloadSize))
|
||||
if((payloadSize != 0) && (stream_len > payloadSize))
|
||||
{
|
||||
if(testNum == 0)
|
||||
{
|
||||
@ -680,10 +671,10 @@ int main(int argc, char* argv[])
|
||||
printf("\nError: Streamsize out of range %d\n", stream_len - payloadSize);
|
||||
cout << flush;
|
||||
}
|
||||
|
||||
kkk = WebRtcIsac_GetUplinkBw(ISAC_main_inst, &sendBN);
|
||||
|
||||
if(stream_len>0)
|
||||
|
||||
WebRtcIsac_GetUplinkBw(ISAC_main_inst, &sendBN);
|
||||
|
||||
if(stream_len>0)
|
||||
{
|
||||
if(doTransCoding)
|
||||
{
|
||||
@ -720,14 +711,13 @@ int main(int argc, char* argv[])
|
||||
numTransCodingBytes += streamLenTransCoding;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
kkk = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(stream_len < 0)
|
||||
if(stream_len < 0)
|
||||
{
|
||||
/* exit if returned with error */
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
@ -740,9 +730,9 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
/* read next bottleneck rate */
|
||||
if(f_bn != NULL)
|
||||
if(f_bn != NULL)
|
||||
{
|
||||
if(fscanf(f_bn, "%d", &bottleneck) == EOF)
|
||||
if(fscanf(f_bn, "%d", &bottleneck) == EOF)
|
||||
{
|
||||
/* Set pointer to beginning of file */
|
||||
fseek(f_bn, 0L, SEEK_SET);
|
||||
@ -766,19 +756,19 @@ int main(int argc, char* argv[])
|
||||
maxStreamLen60 = (stream_len > maxStreamLen60)? stream_len:maxStreamLen60;
|
||||
}
|
||||
|
||||
if(!lostFrame)
|
||||
if(!lostFrame)
|
||||
{
|
||||
lostFrame = ((rand()%100) < packetLossPercent);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
lostFrame = 0;
|
||||
}
|
||||
|
||||
|
||||
// RED.
|
||||
if(lostFrame)
|
||||
if(lostFrame)
|
||||
{
|
||||
stream_len = WebRtcIsac_GetRedPayload(ISAC_main_inst,
|
||||
stream_len = WebRtcIsac_GetRedPayload(ISAC_main_inst,
|
||||
(WebRtc_Word16*)streamdata);
|
||||
|
||||
if(doTransCoding)
|
||||
@ -796,22 +786,22 @@ int main(int argc, char* argv[])
|
||||
|
||||
/* make coded sequence to short be inreasing */
|
||||
/* the length the decoder expects */
|
||||
if(testNum == 4)
|
||||
if(testNum == 4)
|
||||
{
|
||||
stream_len += 10;
|
||||
}
|
||||
|
||||
/* make coded sequence to long be decreasing */
|
||||
/* the length the decoder expects */
|
||||
if(testNum == 5)
|
||||
if(testNum == 5)
|
||||
{
|
||||
stream_len -= 10;
|
||||
}
|
||||
|
||||
if(testNum == 6)
|
||||
if(testNum == 6)
|
||||
{
|
||||
srand((unsigned int)time(NULL));
|
||||
for(i = 0; i < stream_len; i++)
|
||||
for(i = 0; i < stream_len; i++)
|
||||
{
|
||||
streamdata[i] = rand();
|
||||
}
|
||||
@ -822,7 +812,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
/* simulate packet handling through NetEq and the modem */
|
||||
if(!(testNum == 3 && framecnt == 0))
|
||||
if(!(testNum == 3 && framecnt == 0))
|
||||
{
|
||||
get_arrival_time(cur_framesmpls, stream_len, bottleneck, &BN_data,
|
||||
sampFreqKHz*1000, sampFreqKHz*1000);
|
||||
@ -831,26 +821,26 @@ int main(int argc, char* argv[])
|
||||
if(VADusage && (framecnt>10 && vaddata[0]==0))
|
||||
{
|
||||
BN_data.rtp_number--;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Error test number 10, garbage data */
|
||||
if(testNum == 10)
|
||||
if(testNum == 10)
|
||||
{
|
||||
/* Test to run decoder with garbage data */
|
||||
for(i = 0; i < stream_len; i++)
|
||||
for(i = 0; i < stream_len; i++)
|
||||
{
|
||||
streamdata[i] = (short) (streamdata[i]) + (short) rand();
|
||||
}
|
||||
}
|
||||
|
||||
if(testNum != 9)
|
||||
if(testNum != 9)
|
||||
{
|
||||
err = WebRtcIsac_UpdateBwEstimate(ISAC_main_inst, streamdata,
|
||||
stream_len, BN_data.rtp_number, BN_data.sample_count,
|
||||
err = WebRtcIsac_UpdateBwEstimate(ISAC_main_inst, streamdata,
|
||||
stream_len, BN_data.rtp_number, BN_data.sample_count,
|
||||
BN_data.arrival_time);
|
||||
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
/* exit if returned with error */
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
@ -868,11 +858,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Call getFramelen, only used here for function test */
|
||||
err = WebRtcIsac_ReadFrameLen(ISAC_main_inst,
|
||||
err = WebRtcIsac_ReadFrameLen(ISAC_main_inst,
|
||||
(WebRtc_Word16*)streamdata, &FL);
|
||||
if(err < 0)
|
||||
if(err < 0)
|
||||
{
|
||||
/* exit if returned with error */
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
@ -889,7 +879,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
// iSAC decoding
|
||||
|
||||
|
||||
if(lostFrame)
|
||||
{
|
||||
declen = WebRtcIsac_DecodeRcu(ISAC_main_inst, streamdata,
|
||||
@ -897,8 +887,8 @@ int main(int argc, char* argv[])
|
||||
|
||||
if(doTransCoding)
|
||||
{
|
||||
declenTC = WebRtcIsac_DecodeRcu(decoderTransCoding,
|
||||
streamDataTransCoding, streamLenTransCoding,
|
||||
declenTC = WebRtcIsac_DecodeRcu(decoderTransCoding,
|
||||
streamDataTransCoding, streamLenTransCoding,
|
||||
decodedTC, speechType);
|
||||
}
|
||||
}
|
||||
@ -909,13 +899,13 @@ int main(int argc, char* argv[])
|
||||
|
||||
if(doTransCoding)
|
||||
{
|
||||
declenTC = WebRtcIsac_Decode(decoderTransCoding,
|
||||
declenTC = WebRtcIsac_Decode(decoderTransCoding,
|
||||
streamDataTransCoding, streamLenTransCoding,
|
||||
decodedTC, speechType);
|
||||
}
|
||||
}
|
||||
|
||||
if(declen < 0)
|
||||
if(declen < 0)
|
||||
{
|
||||
/* exit if returned with error */
|
||||
errtype=WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
@ -957,36 +947,36 @@ int main(int argc, char* argv[])
|
||||
fwrite(decodedTC, sizeof(WebRtc_Word16), declen, transCodingFile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
fprintf(stderr, "\rframe = %5d ", framecnt);
|
||||
fflush(stderr);
|
||||
framecnt++;
|
||||
|
||||
|
||||
/* Error test number 10, garbage data */
|
||||
//if(testNum == 10)
|
||||
//if(testNum == 10)
|
||||
//{
|
||||
// /* Test to run decoder with garbage data */
|
||||
// if( (seedfile = fopen(SEED_FILE, "a+t") ) == NULL )
|
||||
// if( (seedfile = fopen(SEED_FILE, "a+t") ) == NULL )
|
||||
// {
|
||||
// fprintf(stderr, "Error: Could not open file %s\n", SEED_FILE);
|
||||
// }
|
||||
// else
|
||||
// else
|
||||
// {
|
||||
// fprintf(seedfile, "ok\n\n");
|
||||
// fclose(seedfile);
|
||||
// }
|
||||
//}
|
||||
/* Error test number 10, garbage data */
|
||||
//if(testNum == 10)
|
||||
//if(testNum == 10)
|
||||
//{
|
||||
// /* Test to run decoder with garbage data */
|
||||
// for ( i = 0; i < stream_len; i++)
|
||||
// for ( i = 0; i < stream_len; i++)
|
||||
// {
|
||||
// streamdata[i] = (short) (streamdata[i] + (short) rand());
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
totalsmpls += declen;
|
||||
totalbits += 8 * stream_len;
|
||||
#ifdef _DEBUG
|
||||
@ -994,13 +984,13 @@ int main(int argc, char* argv[])
|
||||
fy = fopen("bit_rate.dat", "a");
|
||||
fprintf(fy, "Frame %i = %0.14f\n", framecnt, kbps);
|
||||
fclose(fy);
|
||||
|
||||
|
||||
#endif /* _DEBUG */
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
printf("total bits = %d bits\n", totalbits);
|
||||
printf("measured average bitrate = %0.3f kbits/s\n",
|
||||
printf("measured average bitrate = %0.3f kbits/s\n",
|
||||
(double)totalbits *(sampFreqKHz) / totalsmpls);
|
||||
if(doTransCoding)
|
||||
{
|
||||
@ -1009,23 +999,23 @@ int main(int argc, char* argv[])
|
||||
fclose(transCodingFile);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
|
||||
/* Runtime statistics */
|
||||
runtime = (double)(clock()/(double)CLOCKS_PER_SEC-starttime);
|
||||
length_file = length_file /(sampFreqKHz * 1000.);
|
||||
|
||||
|
||||
printf("\n\nLength of speech file: %.1f s\n", length_file);
|
||||
printf("Time to run iSAC: %.2f s (%.2f %% of realtime)\n\n", runtime, (100*runtime/length_file));
|
||||
|
||||
if(maxStreamLen30 != 0)
|
||||
{
|
||||
printf("Maximum payload size 30ms Frames %d bytes (%0.3f kbps)\n",
|
||||
printf("Maximum payload size 30ms Frames %d bytes (%0.3f kbps)\n",
|
||||
maxStreamLen30,
|
||||
maxStreamLen30 * 8 / 30.);
|
||||
}
|
||||
if(maxStreamLen60 != 0)
|
||||
{
|
||||
printf("Maximum payload size 60ms Frames %d bytes (%0.3f kbps)\n",
|
||||
printf("Maximum payload size 60ms Frames %d bytes (%0.3f kbps)\n",
|
||||
maxStreamLen60,
|
||||
maxStreamLen60 * 8 / 60.);
|
||||
}
|
||||
@ -1035,13 +1025,13 @@ int main(int argc, char* argv[])
|
||||
fprintf(stderr, " %0.1f kbps", (double)totalbits *(sampFreqKHz) / totalsmpls);
|
||||
if(maxStreamLen30 != 0)
|
||||
{
|
||||
fprintf(stderr, " plmax-30ms %d bytes (%0.0f kbps)",
|
||||
fprintf(stderr, " plmax-30ms %d bytes (%0.0f kbps)",
|
||||
maxStreamLen30,
|
||||
maxStreamLen30 * 8 / 30.);
|
||||
}
|
||||
if(maxStreamLen60 != 0)
|
||||
{
|
||||
fprintf(stderr, " plmax-60ms %d bytes (%0.0f kbps)",
|
||||
fprintf(stderr, " plmax-60ms %d bytes (%0.0f kbps)",
|
||||
maxStreamLen60,
|
||||
maxStreamLen60 * 8 / 60.);
|
||||
}
|
||||
@ -1057,4 +1047,4 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,6 @@ int main(int argc, char* argv[])
|
||||
BottleNeckModel* packetData[MAX_NUM_CLIENTS];
|
||||
|
||||
char versionNumber[100];
|
||||
short bottleneckChange[MAX_NUM_CLIENTS];
|
||||
short samplesIn10ms[MAX_NUM_CLIENTS];
|
||||
int bottleneck[MAX_NUM_CLIENTS];
|
||||
|
||||
@ -108,7 +107,6 @@ int main(int argc, char* argv[])
|
||||
(encoderSampRate[clientCntr] == kIsacWideband)
|
||||
? "wideband":"super-wideband");
|
||||
|
||||
bottleneckChange[clientCntr] = 2 * clientCntr - 1;
|
||||
// Open output File Name
|
||||
OPEN_FILE_WB(outFile[clientCntr], outFileName[clientCntr]);
|
||||
printf("Output File...................... %s\n", outFileName[clientCntr]);
|
||||
|
@ -151,7 +151,7 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char filename[128];
|
||||
_rtpStream = rtpStream;
|
||||
int playSampFreq;
|
||||
@ -177,7 +177,7 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
||||
sprintf(filename, "%s/outFile.pcm", webrtc::test::OutputPath().c_str());
|
||||
_pcmFile.Open(filename, 32000, "wb+");
|
||||
}
|
||||
|
||||
|
||||
_realPayloadSizeBytes = 0;
|
||||
_playoutBuffer = new WebRtc_Word16[WEBRTC_10MS_PCM_AUDIO];
|
||||
_frequency = playSampFreq;
|
||||
@ -291,7 +291,6 @@ void EncodeDecodeTest::Perform() {
|
||||
|
||||
int numCodecs = 1;
|
||||
int codePars[3]; //freq, pacsize, rate
|
||||
int playoutFreq[3]; //8, 16, 32k
|
||||
int numPars[52]; //number of codec parameters sets (rate,freq,pacsize)to test,
|
||||
//for a given codec
|
||||
|
||||
@ -318,7 +317,6 @@ void EncodeDecodeTest::Perform() {
|
||||
}
|
||||
}
|
||||
AudioCodingModule::Destroy(acmTmp);
|
||||
playoutFreq[1] = 16000;
|
||||
} else if (_testMode == 0) {
|
||||
AudioCodingModule *acmTmp = AudioCodingModule::Create(0);
|
||||
numCodecs = acmTmp->NumberOfCodecs();
|
||||
@ -337,11 +335,9 @@ void EncodeDecodeTest::Perform() {
|
||||
numPars[i] = 0;
|
||||
}
|
||||
}
|
||||
playoutFreq[1] = 16000;
|
||||
} else {
|
||||
numCodecs = 1;
|
||||
numPars[0] = 1;
|
||||
playoutFreq[1]=16000;
|
||||
}
|
||||
|
||||
_receiver.testMode = _testMode;
|
||||
|
@ -53,7 +53,6 @@ TestVADDTX::~TestVADDTX()
|
||||
|
||||
void TestVADDTX::Perform()
|
||||
{
|
||||
|
||||
if(_testMode == 0)
|
||||
{
|
||||
printf("Running VAD/DTX Test");
|
||||
@ -86,7 +85,7 @@ void TestVADDTX::Perform()
|
||||
}
|
||||
|
||||
// Create and connect the channel
|
||||
_channelA2B = new Channel;
|
||||
_channelA2B = new Channel;
|
||||
_acmA->RegisterTransportCallback(_channelA2B);
|
||||
_channelA2B->RegisterReceiverACM(_acmB);
|
||||
|
||||
@ -167,14 +166,14 @@ void TestVADDTX::runTestCases()
|
||||
SetVAD(false, true, VADNormal);
|
||||
Run();
|
||||
_testResults += VerifyTest();
|
||||
|
||||
|
||||
// #2 DTX = OFF, VAD = ON, VADAggr
|
||||
if(_testMode != 0)
|
||||
printf("Test #2 ");
|
||||
SetVAD(false, true, VADAggr);
|
||||
Run();
|
||||
_testResults += VerifyTest();
|
||||
|
||||
|
||||
// #3 DTX = ON, VAD = ON, VADLowBitrate
|
||||
if(_testMode != 0)
|
||||
printf("Test #3 ");
|
||||
@ -213,30 +212,33 @@ void TestVADDTX::runTestInternalDTX()
|
||||
|
||||
void TestVADDTX::SetVAD(bool statusDTX, bool statusVAD, WebRtc_Word16 vadMode)
|
||||
{
|
||||
WebRtc_Word32 status;
|
||||
bool dtxEnabled, vadEnabled;
|
||||
ACMVADMode vadModeSet;
|
||||
|
||||
status = _acmA->SetVAD(statusDTX, statusVAD, (ACMVADMode) vadMode);
|
||||
status = _acmA->VAD(dtxEnabled, vadEnabled, vadModeSet);
|
||||
|
||||
if (_acmA->SetVAD(statusDTX, statusVAD, (ACMVADMode) vadMode) < 0) {
|
||||
assert(false);
|
||||
}
|
||||
if (_acmA->VAD(dtxEnabled, vadEnabled, vadModeSet) < 0) {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if(_testMode != 0)
|
||||
{
|
||||
if(statusDTX != dtxEnabled)
|
||||
if(statusDTX != dtxEnabled)
|
||||
{
|
||||
printf("DTX: %s not the same as requested: %s\n",
|
||||
printf("DTX: %s not the same as requested: %s\n",
|
||||
dtxEnabled? "ON":"OFF", dtxEnabled? "OFF":"ON");
|
||||
}
|
||||
if(((statusVAD == true) && (vadEnabled == false)) ||
|
||||
((statusVAD == false) && (vadEnabled == false) &&
|
||||
(statusDTX == true)))
|
||||
{
|
||||
printf("VAD: %s not the same as requested: %s\n",
|
||||
printf("VAD: %s not the same as requested: %s\n",
|
||||
vadEnabled? "ON":"OFF", vadEnabled? "OFF":"ON");
|
||||
}
|
||||
if(vadModeSet != vadMode)
|
||||
if(vadModeSet != vadMode)
|
||||
{
|
||||
printf("VAD mode: %d not the same as requested: %d\n",
|
||||
printf("VAD mode: %d not the same as requested: %d\n",
|
||||
(WebRtc_Word16)vadModeSet, (WebRtc_Word16)vadMode);
|
||||
}
|
||||
}
|
||||
@ -256,11 +258,12 @@ void TestVADDTX::SetVAD(bool statusDTX, bool statusVAD, WebRtc_Word16 vadMode)
|
||||
VADDTXstruct TestVADDTX::GetVAD()
|
||||
{
|
||||
VADDTXstruct retStruct;
|
||||
WebRtc_Word32 status;
|
||||
bool dtxEnabled, vadEnabled;
|
||||
ACMVADMode vadModeSet;
|
||||
|
||||
status = _acmA->VAD(dtxEnabled, vadEnabled, vadModeSet);
|
||||
if (_acmA->VAD(dtxEnabled, vadEnabled, vadModeSet) < 0) {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
retStruct.statusDTX = dtxEnabled;
|
||||
retStruct.statusVAD = vadEnabled;
|
||||
@ -268,8 +271,8 @@ VADDTXstruct TestVADDTX::GetVAD()
|
||||
return retStruct;
|
||||
}
|
||||
|
||||
WebRtc_Word16 TestVADDTX::RegisterSendCodec(char side,
|
||||
char* codecName,
|
||||
WebRtc_Word16 TestVADDTX::RegisterSendCodec(char side,
|
||||
char* codecName,
|
||||
WebRtc_Word32 samplingFreqHz,
|
||||
WebRtc_Word32 rateKbps)
|
||||
{
|
||||
@ -299,9 +302,9 @@ WebRtc_Word16 TestVADDTX::RegisterSendCodec(char side,
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
CodecInst myCodecParam;
|
||||
for(WebRtc_Word16 codecCntr = 0; codecCntr < myACM->NumberOfCodecs();
|
||||
for(WebRtc_Word16 codecCntr = 0; codecCntr < myACM->NumberOfCodecs();
|
||||
codecCntr++)
|
||||
{
|
||||
CHECK_ERROR(myACM->Codec((WebRtc_UWord8)codecCntr, myCodecParam));
|
||||
@ -382,7 +385,7 @@ WebRtc_Word16 TestVADDTX::VerifyTest()
|
||||
(STR_CASE_CMP(myCodecParam.plname,"G723") == 0) ||
|
||||
(STR_CASE_CMP(myCodecParam.plname,"AMR") == 0) ||
|
||||
(STR_CASE_CMP(myCodecParam.plname,"AMR-wb") == 0) ||
|
||||
(STR_CASE_CMP(myCodecParam.plname,"speex") == 0))
|
||||
(STR_CASE_CMP(myCodecParam.plname,"speex") == 0))
|
||||
{
|
||||
_acmA->IsInternalDTXReplacedWithWebRtc(isReplaced);
|
||||
if (!isReplaced)
|
||||
@ -390,7 +393,7 @@ WebRtc_Word16 TestVADDTX::VerifyTest()
|
||||
dtxInUse = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check for error in VAD/DTX settings
|
||||
if (_getStruct.statusDTX != _setStruct.statusDTX){
|
||||
// DTX status doesn't match expected
|
||||
@ -398,13 +401,13 @@ WebRtc_Word16 TestVADDTX::VerifyTest()
|
||||
}
|
||||
if (_getStruct.statusDTX){
|
||||
if ((!_getStruct.statusVAD && dtxInUse) || (!dtxInUse && (_getStruct.statusVAD !=_setStruct.statusVAD)))
|
||||
{
|
||||
{
|
||||
// Missmatch in VAD setting
|
||||
vadPattern |= 2;
|
||||
}
|
||||
} else {
|
||||
if (_getStruct.statusVAD != _setStruct.statusVAD){
|
||||
// VAD status doesn't match expected
|
||||
// VAD status doesn't match expected
|
||||
vadPattern |= 2;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ int func_test(int sel)
|
||||
TEST_LOG("- - - - - - - - - - - - - - - - - - - -\n");
|
||||
TEST_LOG("\n: ");
|
||||
|
||||
int dummy(0);
|
||||
int selection(0);
|
||||
enum TestType testType(TTInvalid);
|
||||
|
||||
@ -89,7 +88,9 @@ SHOW_MENU:
|
||||
}
|
||||
else
|
||||
{
|
||||
dummy = scanf("%d", &selection);
|
||||
if (scanf("%d", &selection) < 0) {
|
||||
perror("Failed to get selection.");
|
||||
}
|
||||
}
|
||||
|
||||
switch (selection)
|
||||
@ -97,40 +98,40 @@ SHOW_MENU:
|
||||
case 0:
|
||||
quit = true;
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
testType = TTAll;
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
testType = TTAudioLayerSelection;
|
||||
break;
|
||||
case 3:
|
||||
case 3:
|
||||
testType = TTDeviceEnumeration;
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
testType = TTDeviceSelection;
|
||||
break;
|
||||
case 5:
|
||||
case 5:
|
||||
testType = TTAudioTransport;
|
||||
break;
|
||||
case 6:
|
||||
case 6:
|
||||
testType = TTSpeakerVolume;
|
||||
break;
|
||||
case 7:
|
||||
case 7:
|
||||
testType = TTMicrophoneVolume;
|
||||
break;
|
||||
case 8:
|
||||
case 8:
|
||||
testType = TTSpeakerMute;
|
||||
break;
|
||||
case 9:
|
||||
case 9:
|
||||
testType = TTMicrophoneMute;
|
||||
break;
|
||||
case 10:
|
||||
case 10:
|
||||
testType = TTMicrophoneBoost;
|
||||
break;
|
||||
case 11:
|
||||
case 11:
|
||||
testType = TTMicrophoneAGC;
|
||||
break;
|
||||
case 12:
|
||||
case 12:
|
||||
testType = TTLoopback;
|
||||
break;
|
||||
case 13:
|
||||
|
@ -664,58 +664,56 @@ WebRtc_Word32 FuncTestManager::Close()
|
||||
|
||||
WebRtc_Word32 FuncTestManager::DoTest(const TestType testType)
|
||||
{
|
||||
WebRtc_UWord32 ret(0);
|
||||
|
||||
switch (testType)
|
||||
{
|
||||
case TTAll:
|
||||
ret = TestAudioLayerSelection();
|
||||
ret = TestDeviceEnumeration();
|
||||
ret = TestDeviceSelection();
|
||||
ret = TestAudioTransport();
|
||||
ret = TestSpeakerVolume();
|
||||
ret = TestMicrophoneVolume();
|
||||
ret = TestLoopback();
|
||||
TestAudioLayerSelection();
|
||||
TestDeviceEnumeration();
|
||||
TestDeviceSelection();
|
||||
TestAudioTransport();
|
||||
TestSpeakerVolume();
|
||||
TestMicrophoneVolume();
|
||||
TestLoopback();
|
||||
case TTAudioLayerSelection:
|
||||
TestAudioLayerSelection();
|
||||
break;
|
||||
case TTDeviceEnumeration:
|
||||
ret = TestDeviceEnumeration();
|
||||
TestDeviceEnumeration();
|
||||
break;
|
||||
case TTDeviceSelection:
|
||||
ret = TestDeviceSelection();
|
||||
TestDeviceSelection();
|
||||
break;
|
||||
case TTAudioTransport:
|
||||
ret = TestAudioTransport();
|
||||
TestAudioTransport();
|
||||
break;
|
||||
case TTSpeakerVolume:
|
||||
ret = TestSpeakerVolume();
|
||||
TestSpeakerVolume();
|
||||
break;
|
||||
case TTMicrophoneVolume:
|
||||
ret = TestMicrophoneVolume();
|
||||
TestMicrophoneVolume();
|
||||
break;
|
||||
case TTSpeakerMute:
|
||||
ret = TestSpeakerMute();
|
||||
TestSpeakerMute();
|
||||
break;
|
||||
case TTMicrophoneMute:
|
||||
ret = TestMicrophoneMute();
|
||||
TestMicrophoneMute();
|
||||
break;
|
||||
case TTMicrophoneBoost:
|
||||
ret = TestMicrophoneBoost();
|
||||
TestMicrophoneBoost();
|
||||
break;
|
||||
case TTMicrophoneAGC:
|
||||
ret = TestMicrophoneAGC();
|
||||
TestMicrophoneAGC();
|
||||
break;
|
||||
case TTLoopback:
|
||||
ret = TestLoopback();
|
||||
TestLoopback();
|
||||
break;
|
||||
case TTDeviceRemoval:
|
||||
ret = TestDeviceRemoval();
|
||||
TestDeviceRemoval();
|
||||
break;
|
||||
case TTMobileAPI:
|
||||
ret = TestAdvancedMBAPI();
|
||||
TestAdvancedMBAPI();
|
||||
case TTTest:
|
||||
ret = TestExtra();
|
||||
TestExtra();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -88,11 +88,11 @@ void RtcpFormatRembTest::TearDown() {
|
||||
}
|
||||
|
||||
TEST_F(RtcpFormatRembTest, TestBasicAPI) {
|
||||
EXPECT_EQ(false, rtcp_sender_->REMB());
|
||||
EXPECT_FALSE(rtcp_sender_->REMB());
|
||||
EXPECT_EQ(0, rtcp_sender_->SetREMBStatus(true));
|
||||
EXPECT_EQ(true, rtcp_sender_->REMB());
|
||||
EXPECT_TRUE(rtcp_sender_->REMB());
|
||||
EXPECT_EQ(0, rtcp_sender_->SetREMBStatus(false));
|
||||
EXPECT_EQ(false, rtcp_sender_->REMB());
|
||||
EXPECT_FALSE(rtcp_sender_->REMB());
|
||||
|
||||
EXPECT_EQ(0, rtcp_sender_->SetREMBData(1234, 0, NULL));
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ TEST_F(RtpRtcpAPITest, Basic) {
|
||||
EXPECT_EQ(0, module->SetStartTimestamp(test_timestamp));
|
||||
EXPECT_EQ(test_timestamp, module->StartTimestamp());
|
||||
|
||||
EXPECT_EQ(false, module->Sending());
|
||||
EXPECT_FALSE(module->Sending());
|
||||
EXPECT_EQ(0, module->SetSendingStatus(true));
|
||||
EXPECT_EQ(true, module->Sending());
|
||||
EXPECT_TRUE(module->Sending());
|
||||
}
|
||||
|
||||
TEST_F(RtpRtcpAPITest, MTU) {
|
||||
@ -108,11 +108,11 @@ TEST_F(RtpRtcpAPITest, RTCP) {
|
||||
EXPECT_STRCASEEQ(cName, "john.doe@test.test");
|
||||
EXPECT_EQ(-1, module->CNAME(NULL));
|
||||
|
||||
EXPECT_EQ(false, module->TMMBR());
|
||||
EXPECT_FALSE(module->TMMBR());
|
||||
EXPECT_EQ(0, module->SetTMMBRStatus(true));
|
||||
EXPECT_EQ(true, module->TMMBR());
|
||||
EXPECT_TRUE(module->TMMBR());
|
||||
EXPECT_EQ(0, module->SetTMMBRStatus(false));
|
||||
EXPECT_EQ(false, module->TMMBR());
|
||||
EXPECT_FALSE(module->TMMBR());
|
||||
|
||||
EXPECT_EQ(kNackOff, module->NACK());
|
||||
EXPECT_EQ(0, module->SetNACKStatus(kNackRtcp));
|
||||
|
@ -65,7 +65,7 @@ class VerifyingAudioReceiver : public RtpData {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(false, true) << "This code path should never happen.";
|
||||
ADD_FAILURE() << "This code path should never happen.";
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -192,7 +192,7 @@ TEST_F(RtpRtcpAudioTest, Basic) {
|
||||
EXPECT_EQ(0, module1->SetSSRC(test_ssrc));
|
||||
EXPECT_EQ(0, module1->SetStartTimestamp(test_timestamp));
|
||||
|
||||
EXPECT_EQ(false, module1->TelephoneEvent());
|
||||
EXPECT_FALSE(module1->TelephoneEvent());
|
||||
|
||||
// Test detection at the end of a DTMF tone.
|
||||
EXPECT_EQ(0, module2->SetTelephoneEventStatus(true, true, true));
|
||||
|
@ -145,7 +145,7 @@ TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
||||
FillPacket(0);
|
||||
ASSERT_EQ(kPacketBufferSize,
|
||||
session_.InsertPacket(packet_, frame_buffer_, false, 0));
|
||||
EXPECT_EQ(false, session_.HaveLastPacket());
|
||||
EXPECT_FALSE(session_.HaveLastPacket());
|
||||
EXPECT_EQ(kVideoFrameKey, session_.FrameType());
|
||||
|
||||
packet_.isFirstPacket = false;
|
||||
@ -153,7 +153,7 @@ TEST_F(TestSessionInfo, TestSimpleAPIs) {
|
||||
packet_.seqNum += 1;
|
||||
ASSERT_EQ(kPacketBufferSize,
|
||||
session_.InsertPacket(packet_, frame_buffer_, false, 0));
|
||||
EXPECT_EQ(true, session_.HaveLastPacket());
|
||||
EXPECT_TRUE(session_.HaveLastPacket());
|
||||
EXPECT_EQ(packet_.seqNum, session_.HighSequenceNumber());
|
||||
EXPECT_EQ(0xFFFE, session_.LowSequenceNumber());
|
||||
|
||||
@ -804,7 +804,7 @@ TEST_F(TestNackList, NoLosses) {
|
||||
EXPECT_EQ(10 * kPacketBufferSize, session_.SessionLength());
|
||||
BuildSeqNumList(low, packet_.seqNum);
|
||||
EXPECT_EQ(0, session_.BuildHardNackList(seq_num_list_, seq_num_list_length_));
|
||||
EXPECT_EQ(false, session_.session_nack());
|
||||
EXPECT_FALSE(session_.session_nack());
|
||||
SCOPED_TRACE("Calling VerifyAll");
|
||||
VerifyAll(-1);
|
||||
|
||||
|
@ -275,7 +275,6 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
const float nBitrates = sizeof(bitRate)/sizeof(*bitRate);
|
||||
float _bitRate = 0;
|
||||
int _frameCnt = 0;
|
||||
WebRtc_Word64 startTime, currentTime, oneSecTime;
|
||||
float totalBytesOneSec;//, totalBytesTenSec;
|
||||
float totalBytes, actualBitrate;
|
||||
VCMFrameCount frameCount; // testing frame type counters
|
||||
@ -309,7 +308,6 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
_vcm->SetChannelParameters((WebRtc_UWord32)_bitRate, 0, 20);
|
||||
_frameCnt = 0;
|
||||
totalBytes = 0;
|
||||
startTime = _clock->MicrosecondTimestamp();
|
||||
_encodeCompleteCallback->Initialize();
|
||||
sendStats.SetTargetFrameRate(static_cast<WebRtc_UWord32>(_frameRate));
|
||||
_vcm->RegisterSendStatisticsCallback(&sendStats);
|
||||
@ -333,7 +331,6 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
//currentTime = VCMTickTime::MillisecondTimestamp();//clock()/(double)CLOCKS_PER_SEC;
|
||||
if (_frameCnt == _frameRate)// @ 1sec
|
||||
{
|
||||
oneSecTime = _clock->MicrosecondTimestamp();
|
||||
totalBytesOneSec = _encodeCompleteCallback->EncodedBytes();//totalBytes;
|
||||
}
|
||||
TEST(_vcm->TimeUntilNextProcess() >= 0);
|
||||
@ -343,7 +340,6 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
// estimating rates
|
||||
// complete sequence
|
||||
// bit rate assumes input frame rate is as specified
|
||||
currentTime = _clock->MicrosecondTimestamp();
|
||||
totalBytes = _encodeCompleteCallback->EncodedBytes();
|
||||
actualBitrate = (float)(8.0/1000)*(totalBytes / (_frameCnt / _frameRate));
|
||||
|
||||
@ -367,7 +363,6 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
/********************************/
|
||||
/* Encoder Pipeline Delay Test */
|
||||
/******************************/
|
||||
WebRtc_Word32 retVal;
|
||||
_vcm->InitializeSender();
|
||||
sourceFrame.Free();
|
||||
sourceFrame.VerifyAndAllocate(_lengthSourceFrame);
|
||||
@ -376,11 +371,11 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
// going over all available codecs
|
||||
for (int k = 0; k < NumberOfCodecs; k++)
|
||||
{
|
||||
retVal = _vcm->Codec(k, &_sendCodec);
|
||||
retVal = _vcm->InitializeSender();
|
||||
_vcm->Codec(k, &_sendCodec);
|
||||
_vcm->InitializeSender();
|
||||
_sendCodec.maxBitrate = 8000;
|
||||
retVal = _vcm->RegisterSendCodec(&_sendCodec, 4, 1440);
|
||||
retVal = _vcm->RegisterTransportCallback(_encodeCompleteCallback);
|
||||
_vcm->RegisterSendCodec(&_sendCodec, 4, 1440);
|
||||
_vcm->RegisterTransportCallback(_encodeCompleteCallback);
|
||||
|
||||
_frameCnt = 0;
|
||||
encodeComplete = false;
|
||||
@ -393,7 +388,7 @@ GenericCodecTest::Perform(CmdArgs& args)
|
||||
sourceFrame.SetWidth(_width);
|
||||
_timeStamp += (WebRtc_UWord32)(9e4 / static_cast<float>(_frameRate));
|
||||
sourceFrame.SetTimeStamp(_timeStamp);
|
||||
retVal = _vcm->AddVideoFrame(sourceFrame);
|
||||
_vcm->AddVideoFrame(sourceFrame);
|
||||
encodeComplete = _encodeCompleteCallback->EncodeComplete();
|
||||
} // first frame encoded
|
||||
printf ("\n Codec type = %s \n", _sendCodec.plName);
|
||||
|
@ -470,40 +470,6 @@ VCMQMDecodeCompleCallback::SetOriginalFrameDimensions(WebRtc_Word32 width, WebRt
|
||||
WebRtc_Word32
|
||||
VCMQMDecodeCompleCallback::buildInterpolator()
|
||||
{
|
||||
// if (_interpolator != NULL)
|
||||
// {
|
||||
// deleteInterpolator(_interpolator);
|
||||
// _interpolator = NULL;
|
||||
// }
|
||||
|
||||
// create decimator
|
||||
WebRtc_Word32 filterPar = 4; //Lanczos (assuming sampling ratio is 1, 1.5, 2, 4)
|
||||
|
||||
float HeightRatio = 0;
|
||||
float WidthRatio = 0;
|
||||
|
||||
WidthRatio = (float)_origWidth/(float)_decWidth;
|
||||
HeightRatio = (float)_origHeight/(float)_decHeight;
|
||||
|
||||
if ( (HeightRatio == 1.0 || HeightRatio == 1.5 || HeightRatio == 2 || HeightRatio == 4) &&
|
||||
(WidthRatio == 1.0 || WidthRatio == 1.5 || WidthRatio == 2 || WidthRatio == 4))
|
||||
{
|
||||
filterPar = 4; //Lanczos
|
||||
} else
|
||||
{
|
||||
filterPar = 0; //BiCubic
|
||||
}
|
||||
|
||||
|
||||
// define interpolator here
|
||||
|
||||
// create interpolator here
|
||||
|
||||
// if (_interpolator == NULL)
|
||||
// {
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
WebRtc_UWord32 decFrameLength = _origWidth*_origHeight*3 >> 1;
|
||||
if (_decBuffer != NULL)
|
||||
{
|
||||
|
@ -67,7 +67,6 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
WebRtc_UWord32 waitTime = 0;
|
||||
WebRtc_UWord32 jitterDelayMs = 0;
|
||||
WebRtc_UWord32 maxDecodeTimeMs = 0;
|
||||
WebRtc_UWord32 extraDelayMs = 0;
|
||||
WebRtc_UWord32 timeStamp = 0;
|
||||
|
||||
timing.Reset(static_cast<WebRtc_Word64>(clockInMs + 0.5));
|
||||
@ -170,7 +169,6 @@ int ReceiverTimingTests(CmdArgs& args)
|
||||
|
||||
jitterDelayMs = 60;
|
||||
maxDecodeTimeMs = 10;
|
||||
extraDelayMs = 0;
|
||||
|
||||
timeStamp = static_cast<WebRtc_UWord32>(-10000); // To produce a wrap
|
||||
clockInMs = 10000.0f;
|
||||
|
@ -204,9 +204,9 @@ TEST_F(VideoProcessingModuleTest, FrameStats)
|
||||
ASSERT_EQ(_frameLength, fread(_videoFrame.Buffer(), 1, _frameLength,
|
||||
_sourceFile));
|
||||
|
||||
EXPECT_EQ(false, _vpm->ValidFrameStats(stats));
|
||||
EXPECT_FALSE(_vpm->ValidFrameStats(stats));
|
||||
EXPECT_EQ(0, _vpm->GetFrameStats(stats, _videoFrame));
|
||||
EXPECT_EQ(true, _vpm->ValidFrameStats(stats));
|
||||
EXPECT_TRUE(_vpm->ValidFrameStats(stats));
|
||||
|
||||
printf("\nFrameStats\n");
|
||||
printf("mean: %u\nnumPixels: %u\nsubSamplWidth: "
|
||||
@ -218,7 +218,7 @@ TEST_F(VideoProcessingModuleTest, FrameStats)
|
||||
static_cast<unsigned int>(stats.sum));
|
||||
|
||||
_vpm->ClearFrameStats(stats);
|
||||
EXPECT_EQ(false, _vpm->ValidFrameStats(stats));
|
||||
EXPECT_FALSE(_vpm->ValidFrameStats(stats));
|
||||
}
|
||||
|
||||
TEST_F(VideoProcessingModuleTest, PreprocessorLogic)
|
||||
|
@ -336,7 +336,12 @@ int TestSingleStream(VideoRender* renderModule) {
|
||||
|
||||
printf("Start render\n");
|
||||
error = renderModule->StartRender(streamId0);
|
||||
assert(error == 0);
|
||||
if (error != 0) {
|
||||
// TODO(phoglund): This test will not work if compiled in release mode.
|
||||
// This rather silly construct here is to avoid compilation errors when
|
||||
// compiling in release. Release => no asserts => unused 'error' variable.
|
||||
assert(false);
|
||||
}
|
||||
|
||||
// Loop through an I420 file and render each frame
|
||||
const WebRtc_UWord32 width = 352;
|
||||
|
Loading…
Reference in New Issue
Block a user