Libug: provide option for UDP packet pool

+ set rtp-multithreaded also with value 1 - this will enable the
appropriate code
This commit is contained in:
Martin Pulec
2021-06-01 09:00:05 +02:00
parent 8042cf6b7d
commit 2c7a7c3d2d
2 changed files with 11 additions and 4 deletions

View File

@@ -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<int>(init_params->connections, 1);
if (connections > 1) {
int connections = max<int>(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<int>(init_params->connections, 1);
if (init_params->connections > 1) {
init_params->connections = max<int>(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);

View File

@@ -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);