Skip to content
Snippets Groups Projects
Commit d8302fc0 authored by Gregory Maxwell's avatar Gregory Maxwell
Browse files

Validate channel count in opus_demo.

parent 733b47f3
No related branches found
No related tags found
No related merge requests found
......@@ -308,13 +308,6 @@ int main(int argc, char *argv[])
}
sampling_rate = (opus_int32)atol(argv[args]);
args++;
channels = atoi(argv[args]);
args++;
if (!decode_only)
{
bitrate_bps = (opus_int32)atol(argv[args]);
args++;
}
if (sampling_rate != 8000 && sampling_rate != 12000
&& sampling_rate != 16000 && sampling_rate != 24000
......@@ -326,6 +319,21 @@ int main(int argc, char *argv[])
}
frame_size = sampling_rate/50;
channels = atoi(argv[args]);
args++;
if (channels < 1 || channels > 2)
{
fprintf(stderr, "Opus_demo supports only 1 or 2 channels.\n");
return EXIT_FAILURE;
}
if (!decode_only)
{
bitrate_bps = (opus_int32)atol(argv[args]);
args++;
}
/* defaults: */
use_vbr = 1;
bandwidth = OPUS_AUTO;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment