Added possibility to run quality modes test. Added possibility to input arguments to the test. The test will (for each frame) log the values in contentMetrics to a txt-file. The txt-file can optionally be saved in a specific place. Fixed an issue where video_coding_test crashed if there weren't any parameter submitted to an input argument.

BUG=

Review URL: https://webrtc-codereview.appspot.com/772005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3068 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
brykt@google.com
2012-11-09 16:16:41 +00:00
parent 9cb9fc17b1
commit e8ef807a2d
7 changed files with 886 additions and 749 deletions

View File

@ -37,171 +37,185 @@ int vcmMacrosErrors = 0;
int ParseArguments(int argc, char **argv, CmdArgs& args)
{
int i = 1;
while (i < argc)
{
if (argv[i][0] != '-')
{
return -1;
}
switch (argv[i][1])
{
case 'w':
{
int w = atoi(argv[i+1]);
if (w < 1)
return -1;
args.width = w;
break;
}
case 'h':
{
int h = atoi(argv[i+1]);
if (h < 1)
return -1;
args.height = h;
break;
}
case 'b':
{
int b = atoi(argv[i+1]);
if (b < 1)
return -1;
args.bitRate = b;
break;
}
case 'f':
{
int f = atoi(argv[i+1]);
if (f < 1)
return -1;
args.frameRate = f;
break;
}
case 'c':
{
// TODO(holmer): This should be replaced with a map if more codecs
// are added
args.codecName = argv[i+1];
if (strncmp(argv[i+1], "VP8", 3) == 0)
{
args.codecType = kVideoCodecVP8;
}
else if (strncmp(argv[i+1], "I420", 4) == 0)
{
args.codecType = kVideoCodecI420;
}
else
return -1;
if (argv[i+1] == '\0')
{
printf( "You did not supply a parameter value\n." );
return -1;
}
break;
}
case 'i':
{
args.inputFile = argv[i+1];
break;
}
case 'o':
args.outputFile = argv[i+1];
break;
case 'n':
{
int n = atoi(argv[i+1]);
if (n < 1)
return -1;
args.testNum = n;
break;
}
case 'p':
{
args.packetLoss = atoi(argv[i+1]);
break;
}
case 'r':
{
args.rtt = atoi(argv[i+1]);
break;
}
case 'm':
{
args.protectionMode = atoi(argv[i+1]);
break;
}
case 'e':
{
args.camaEnable = atoi(argv[i+1]);
break;
}
default:
return -1;
}
i += 2;
if (argv[i][0] != '-')
{
return -1;
}
switch (argv[i][1])
{
case 'w':
{
int w = atoi(argv[i+1]);
if (w < 1)
return -1;
args.width = w;
break;
}
case 'h':
{
int h = atoi(argv[i+1]);
if (h < 1)
return -1;
args.height = h;
break;
}
case 'b':
{
int b = atoi(argv[i+1]);
if (b < 1)
return -1;
args.bitRate = b;
break;
}
case 'f':
{
int f = atoi(argv[i+1]);
if (f < 1)
return -1;
args.frameRate = f;
break;
}
case 'c':
{
// TODO(holmer): This should be replaced with a map if more codecs
// are added
args.codecName = argv[i+1];
if (strncmp(argv[i+1], "VP8", 3) == 0)
{
args.codecType = kVideoCodecVP8;
}
else if (strncmp(argv[i+1], "I420", 4) == 0)
{
args.codecType = kVideoCodecI420;
}
else
return -1;
break;
}
case 'i':
{
args.inputFile = argv[i+1];
break;
}
case 'o':
args.outputFile = argv[i+1];
break;
case 'n':
{
int n = atoi(argv[i+1]);
if (n < 1)
return -1;
args.testNum = n;
break;
}
case 'p':
{
args.packetLoss = atoi(argv[i+1]);
break;
}
case 'r':
{
args.rtt = atoi(argv[i+1]);
break;
}
case 'm':
{
args.protectionMode = atoi(argv[i+1]);
break;
}
case 'e':
{
args.camaEnable = atoi(argv[i+1]);
break;
}
case 'v':
{
args.fv_outputfile = argv[i+1];
break;
}
default:
return -1;
}
i += 2;
}
return 0;
}
int main(int argc, char **argv)
{
CmdArgs args;
CmdArgs args;
if (ParseArguments(argc, argv, args) != 0)
{
printf("Unable to parse input arguments\n");
printf("args: -n <test #> -w <width> -h <height> -f <fps> -b <bps> "
"-c <codec> -i <input file> -o <output file> -p <packet loss> "
"-r <round-trip-time> -e <cama enable> -m <protection mode> \n");
return -1;
}
if (ParseArguments(argc, argv, args) != 0)
{
printf("Unable to parse input arguments\n");
printf("args: -n <test #> -w <width> -h <height> -f <fps> -b <bps> "
"-c <codec> -i <input file> -o <output file> -p <packet loss> "
"-r <round-trip-time> -e <cama enable> -m <protection mode> \n");
return -1;
}
int ret = 0;
switch (args.testNum)
{
int ret = 0;
switch (args.testNum) {
case 0:
ret = NormalTest::RunTest(args);
ret |= CodecDataBaseTest::RunTest(args);
ret |= ReceiverTimingTests(args);
ret |= JitterBufferTest(args);
break;
case 1:
ret = NormalTest::RunTest(args);
break;
ret = NormalTest::RunTest(args);
break;
case 2:
ret = MTRxTxTest(args);
break;
ret = MTRxTxTest(args);
break;
case 3:
ret = GenericCodecTest::RunTest(args);
break;
ret = GenericCodecTest::RunTest(args);
break;
case 4:
ret = CodecDataBaseTest::RunTest(args);
break;
ret = CodecDataBaseTest::RunTest(args);
break;
case 5:
// 0- normal, 1-Release test(50 runs) 2- from file
ret = MediaOptTest::RunTest(0, args);
break;
// 0- normal, 1-Release test(50 runs) 2- from file
ret = MediaOptTest::RunTest(0, args);
break;
case 6:
ret = ReceiverTimingTests(args);
break;
ret = ReceiverTimingTests(args);
break;
case 7:
ret = RtpPlay(args);
break;
ret = RtpPlay(args);
break;
case 8:
ret = RtpPlayMT(args);
break;
ret = RtpPlayMT(args);
break;
case 9:
ret = JitterBufferTest(args);
break;
ret = JitterBufferTest(args);
break;
case 10:
ret = DecodeFromStorageTest(args);
break;
ret = DecodeFromStorageTest(args);
break;
case 11:
ret = NormalTest::RunTest(args);
ret |= CodecDataBaseTest::RunTest(args);
ret |= ReceiverTimingTests(args);
ret |= JitterBufferTest(args);
break;
qualityModeTest(args);
break;
default:
ret = -1;
break;
}
if (ret != 0)
{
printf("Test failed!\n");
return -1;
}
return 0;
ret = -1;
break;
}
if (ret != 0)
{
printf("Test failed!\n");
return -1;
}
return 0;
}