diff --git a/src/libug.cpp b/src/libug.cpp index f1d1729fc..d333a3798 100644 --- a/src/libug.cpp +++ b/src/libug.cpp @@ -77,8 +77,8 @@ struct ug_sender *ug_sender_init(const struct ug_sender_parameters *init_params) LOG(LOG_LEVEL_ERROR) << "Receiver must be set!\n"; return nullptr; } - int connections = max(init_params->connections, 1); - if (connections > 1) { + int connections = max(init_params->connections, 0); + if (connections >= 1) { commandline_params["rtp-multithreaded"] = to_string(connections); } @@ -252,10 +252,16 @@ struct ug_receiver *ug_receiver_start(struct ug_receiver_parameters *init_params char display[128] = "vrg"; const char *display_cfg = ""; - init_params->connections = max(init_params->connections, 1); - if (init_params->connections > 1) { + init_params->connections = max(init_params->connections, 0); + if (init_params->connections >= 1) { commandline_params["rtp-multithreaded"] = to_string(init_params->connections); } + if (init_params->udp_packet_pool) { + if (init_params->connections == 0) { + fprintf(stderr, "WARNING: UDP packet pool requires \"rtp-multithreaded\"!\n"); + } + commandline_params["udp-packet-pool"] = string(); + } if (init_params->display != nullptr) { strncpy(display, init_params->display, sizeof display - 1); diff --git a/src/libug.h b/src/libug.h index a00134ebb..28b1bd63f 100644 --- a/src/libug.h +++ b/src/libug.h @@ -81,6 +81,7 @@ struct ug_receiver_parameters { int verbose; ///< verbosity level (optional, default 0, 1 - verbose, 2 - debug) int enable_strips; ///< enable 8x1 strips (to improve compression), default 0 (disable) int connections; ///< number of connections (default 1), must match with sender + int udp_packet_pool; ///< use UDP packet pool (default 0 - no) to increase recv performance, implies connections >= 1 }; LIBUG_DLL struct ug_receiver *ug_receiver_start(struct ug_receiver_parameters *init_params); LIBUG_DLL void ug_receiver_done(struct ug_receiver *state);