parse_options: ensure audio device given once

avoid unintended audio playback/capture devices given

refer GH-316
This commit is contained in:
Martin Pulec
2023-05-31 12:21:01 +02:00
parent f90214d0c9
commit aa24e65598

View File

@@ -809,6 +809,10 @@ static int parse_options(int argc, char *argv[], struct ug_options *opt) {
audio_playback_help(strcmp(optarg, "full") == 0);
return 1;
}
if (string(opt->audio.recv_cfg) != ug_options().audio.recv_cfg) {
log_msg(LOG_LEVEL_ERROR, "Multiple audio playback devices given!\n");
return -EXIT_FAIL_USAGE;
}
opt->audio.recv_cfg = optarg;
break;
case 's':
@@ -816,6 +820,10 @@ static int parse_options(int argc, char *argv[], struct ug_options *opt) {
audio_capture_print_help(strcmp(optarg, "full") == 0);
return 1;
}
if (string(opt->audio.send_cfg) != ug_options().audio.send_cfg) {
log_msg(LOG_LEVEL_ERROR, "Multiple audio capturers given!\n");
return -EXIT_FAIL_USAGE;
}
opt->audio.send_cfg = optarg;
break;
case 'f':