{"record":{"id":"e1e366d05c843341","repo":"DrKLO/Telegram","slug":"usage-test-opus-custom-rate-channels-frame-s","errorCode":null,"errorMessage":"Usage: test_opus_custom <rate> <channels> <frame size>  <bytes per packet> [<complexity> [packet loss rate]] <input> <output>\\n","messagePattern":"Usage: test_opus_custom <rate> <channels> <frame size>  <bytes per packet> \\[<complexity> \\[packet loss rate\\]\\] <input> <output>\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"TMessagesProj/jni/opus/celt/opus_custom_demo.c","lineNumber":64,"sourceCode":"   FILE *fin, *fout;\n   OpusCustomMode *mode=NULL;\n   OpusCustomEncoder *enc;\n   OpusCustomDecoder *dec;\n   int len;\n   opus_int32 frame_size, channels, rate;\n   int bytes_per_packet;\n   unsigned char data[MAX_PACKET];\n   int complexity;\n#if !(defined (FIXED_POINT) && !defined(CUSTOM_MODES)) && defined(RESYNTH)\n   int i;\n   double rmsd = 0;\n#endif\n   int count = 0;\n   opus_int32 skip;\n   opus_int16 *in, *out;\n   if (argc != 9 && argc != 8 && argc != 7)\n   {\n      fprintf (stderr, \"Usage: test_opus_custom <rate> <channels> <frame size> \"\n               \" <bytes per packet> [<complexity> [packet loss rate]] \"\n               \"<input> <output>\\n\");\n      return 1;\n   }\n\n   rate = (opus_int32)atol(argv[1]);\n   channels = atoi(argv[2]);\n   frame_size = atoi(argv[3]);\n   mode = opus_custom_mode_create(rate, frame_size, NULL);\n   if (mode == NULL)\n   {\n      fprintf(stderr, \"failed to create a mode\\n\");\n      return 1;\n   }\n\n   bytes_per_packet = atoi(argv[4]);\n   if (bytes_per_packet < 0 || bytes_per_packet > MAX_PACKET)\n   {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/jni/opus/celt/opus_custom_demo.c#L46-L82","documentation":"Usage message from the opus_custom demo CLI. Printed when argc is not 7, 8, or 9 — i.e. the wrong number of command-line arguments. The expected form is: test_opus_custom <rate> <channels> <frame size> <bytes per packet> [<complexity> [packet loss rate]] <input> <output>.","triggerScenarios":"Invoking the demo binary with fewer than 7 or more than 9 arguments. The two trailing positional args are always input and output files; the optional bracketed ones are complexity (argv[5]) and packet loss rate (argv[argc-3]).","commonSituations":"Missing the output file path; forgetting the bytes-per-packet argument; copy-pasting a command from a different opus tool's syntax; running the demo in a script with an unquoted empty variable that collapses argument count.","solutions":["Count arguments: provide exactly 7 (mandatory only), 8 (+complexity), or 9 (+complexity and packet loss rate).","Ensure input and output file paths are the last two arguments.","Quote shell variables so empty values don't reduce argc."],"exampleFix":"// before\n./test_opus_custom 48000 1 960 input.sw\n\n// after (7 mandatory args: rate channels frame_size bytes_per_packet input output)\n./test_opus_custom 48000 1 960 40 input.sw output.sw","handlingStrategy":"validation","validationCode":"// Validate argc before using any argv slot.\nif (argc != 7 && argc != 8 && argc != 9) {\n    fprintf(stderr, \"Usage: test_opus_custom <rate> <channels> <frame size>\"\n            \" <bytes per packet> [<complexity> [packet loss rate]] <input> <output>\\n\");\n    return 1;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide exactly 7, 8, or 9 arguments with input and output files last.","Quote shell variables so empty values don't collapse argc.","Use a wrapper script that validates argument count before exec."],"tags":["cli","usage","arguments","opus","demo","c"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}