Skip to content

Commit 75a91d8

Browse files
committed
roc_send: --real-time cli parameter
1 parent 5e7fcac commit 75a91d8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/tools/roc_send/cmdline.ggo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ option "verbose" v "Increase verbosity level (may be used multiple times)"
55
multiple optional
66
option "color" - "Set colored logging mode for stderr output"
77
values="auto","always","never" default="auto" enum optional
8+
option "real-time" - "Set realtime priority for timing sensitive threads, 0-99 Requires root privileges."
9+
int typestr="INTEGER" optional default="0"
810

911
option "list-supported" L "List supported protocols, formats, etc." optional
1012

src/tools/roc_send/main.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ bool build_io_config(const gengetopt_args_info& args, sndio::IoConfig& io_config
8282
bool build_context_config(const gengetopt_args_info& args,
8383
const sndio::IoConfig& io_config,
8484
node::ContextConfig& context_config) {
85+
if (args.real_time_arg != 0) {
86+
if (args.real_time_arg < 0 || args.real_time_arg >= 100) {
87+
roc_log(LogError, "invalid --real-time: should be in range [0..99]");
88+
return false;
89+
}
90+
context_config.realtime_prio = args.real_time_arg;
91+
}
92+
8593
if (args.max_packet_size_given) {
8694
if (!core::parse_size(args.max_packet_size_arg, context_config.max_packet_size)) {
8795
roc_log(LogError, "invalid --max-packet-size: bad format");
@@ -613,7 +621,7 @@ int main(int argc, char** argv) {
613621
return 1;
614622
}
615623

616-
const status::StatusCode status = pump.run();
624+
const status::StatusCode status = pump.run(args.real_time_arg);
617625
if (status != status::StatusOK) {
618626
roc_log(LogError, "io pump failed: status=%s", status::code_to_str(status));
619627
return 1;

0 commit comments

Comments
 (0)