diff --git a/data/hd-rum-transcode.1 b/data/hd-rum-transcode.1
index 85807fe0d..83dd87dc8 100644
--- a/data/hd-rum-transcode.1
+++ b/data/hd-rum-transcode.1
@@ -1,13 +1,13 @@
'\" t
.\" Title: hd-rum-transcode
-.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 06/09/2020
+.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot
+.\" Date: 03/29/2021
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "HD\-RUM\-TRANSCODE" "1" "06/09/2020" "\ \&" "\ \&"
+.TH "HD\-RUM\-TRANSCODE" "1" "03/29/2021" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -43,6 +43,7 @@ where global_opts may be:
\-\-blend \- enable blending from original to newly received stream, increases latency
\-\-conference :[:fps] \- enable combining of multiple inputs, increases latency
\-\-capture\-filter \- apply video capture filter to incoming video
+ \-\-param \- additional parameters
\-\-help
\-\-verbose
\-v \- print version
diff --git a/data/uv.1 b/data/uv.1
index 6e43b7b5e..1dab0c082 100644
--- a/data/uv.1
+++ b/data/uv.1
@@ -1,13 +1,13 @@
'\" t
.\" Title: uv
-.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
-.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 06/09/2020
+.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
+.\" Generator: DocBook XSL Stylesheets vsnapshot
+.\" Date: 03/29/2021
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "UV" "1" "06/09/2020" "\ \&" "\ \&"
+.TH "UV" "1" "03/29/2021" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -183,6 +183,16 @@ uv \- UltraGrid command line interface
.RS 4
.\}
.nf
+\-m set path MTU assumption towards receiver
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
\-M received video mode (eg tiled\-4K, 3D,
dual\-link)
.fi
@@ -194,6 +204,16 @@ uv \- UltraGrid command line interface
.RS 4
.\}
.nf
+\-N|\-\-nat\-traverse try to deploy NAT traversal techniques
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
\-p | help postprocess module
.fi
.if n \{\
@@ -204,6 +224,16 @@ uv \- UltraGrid command line interface
.RS 4
.\}
.nf
+\-T/\-\-ttl Use specified TTL for multicast/unicast (0\&.\&.255, \-1 for default)
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
\-f [A:|V:] FEC settings (audio or video) \- use
"none", "mult:",
"ldgm:%%" or
diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp
index 8a6ab396a..d00df038d 100644
--- a/src/audio/audio.cpp
+++ b/src/audio/audio.cpp
@@ -108,6 +108,7 @@ struct audio_network_parameters {
struct pdb *participants = 0;
int force_ip_version = 0;
char *mcast_if = nullptr;
+ int ttl = -1;
};
struct state_audio {
@@ -238,7 +239,8 @@ struct state_audio * audio_cfg_init(struct module *parent, const char *addrs, in
char *audio_channel_map, const char *audio_scale,
bool echo_cancellation, int force_ip_version, const char *mcast_if,
const char *audio_codec_cfg,
- long long int bitrate, volatile int *audio_delay, const std::chrono::steady_clock::time_point *start_time, int mtu, struct exporter *exporter)
+ long long int bitrate, volatile int *audio_delay, const std::chrono::steady_clock::time_point *start_time,
+ int mtu, int ttl, struct exporter *exporter)
{
struct state_audio *s = NULL;
char *tmp, *unused = NULL;
@@ -313,6 +315,7 @@ struct state_audio * audio_cfg_init(struct module *parent, const char *addrs, in
s->audio_network_parameters.force_ip_version = force_ip_version;
s->audio_network_parameters.mcast_if = mcast_if
? strdup(mcast_if) : NULL;
+ s->audio_network_parameters.ttl = ttl;
if ((s->audio_network_device = initialize_audio_network(
&s->audio_network_parameters))
@@ -504,17 +507,8 @@ static struct rtp *initialize_audio_network(struct audio_network_parameters *par
struct rtp *r;
double rtcp_bw = 1024 * 512; // FIXME: something about 5% for rtcp is said in rfc
- int ttl = 255;
- if (commandline_params.find("ttl") != commandline_params.end()) {
- ttl = stoi(commandline_params.at("ttl"));
- if (ttl < -1 || ttl > 255) {
- log_msg(LOG_LEVEL_ERROR, "TTL must be in range 0..255 or -1!");
- return nullptr;
- }
- }
-
r = rtp_init_if(params->addr, params->mcast_if, params->recv_port,
- params->send_port, ttl, rtcp_bw,
+ params->send_port, params->ttl, rtcp_bw,
FALSE, rtp_recv_callback,
(uint8_t *) params->participants,
params->force_ip_version, false);
diff --git a/src/audio/audio.h b/src/audio/audio.h
index 0b90cf9a8..2c9a76e15 100644
--- a/src/audio/audio.h
+++ b/src/audio/audio.h
@@ -67,7 +67,8 @@ struct state_audio * audio_cfg_init(struct module *parent, const char *addrs, in
const char *fec_cfg, const char *encryption,
char *audio_channel_map, const char *audio_scale,
bool echo_cancellation, int force_ip_version, const char *mcast_iface, const char *audio_codec_cfg,
- long long int bitrate, volatile int *audio_delay, const std::chrono::steady_clock::time_point *start_time, int mtu, struct exporter *exporter);
+ long long int bitrate, volatile int *audio_delay, const std::chrono::steady_clock::time_point *start_time,
+ int mtu, int ttl, struct exporter *exporter);
#endif
#ifdef __cplusplus
diff --git a/src/host.cpp b/src/host.cpp
index 5dffe93c3..11e8236ce 100644
--- a/src/host.cpp
+++ b/src/host.cpp
@@ -651,8 +651,6 @@ ADD_TO_PARAM("audio-disable-adaptive-buffer", "* audio-disable-adaptive-buffer\n
ADD_TO_PARAM("low-latency-audio", "* low-latency-audio[=ultra]\n"
" Try to reduce audio latency at the expense of worse reliability\n"
" Add ultra for even more aggressive setting.\n");
-ADD_TO_PARAM("ttl", "* ttl=\n"
- " TTL to be used for transmission in range 0-255 or -1 to use default values.\n");
ADD_TO_PARAM("window-title", "* window-title=\n"
" Use alternative window title (SDL/GL only)\n");
diff --git a/src/main.cpp b/src/main.cpp
index 376584fcc..8083624d2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -380,8 +380,9 @@ static void usage(const char *exec_path, bool full = false)
print_help_item("-m ", {"set path MTU assumption towards receiver"});
print_help_item("-M ", {"received video mode (eg tiled-4K, 3D,",
"dual-link)"});
- print_help_item("-p | help", {"postprocess module"});
print_help_item("-N|--nat-traverse"s, {"try to deploy NAT traversal techniques"s});
+ print_help_item("-p | help", {"postprocess module"});
+ print_help_item("-T/--ttl ", {"Use specified TTL for multicast/unicast (0..255, -1 for default)"});
}
print_help_item("-f [A:|V:]", {"FEC settings (audio or video) - use",
"\"none\", \"mult:\",", "\"ldgm:%%\" or", "\"ldgm:::\"",
@@ -624,6 +625,7 @@ int main(int argc, char *argv[])
char *audio_channel_map = NULL;
const char *audio_scale = "mixauto";
int port_base = PORT_BASE;
+ int requested_ttl = 255;
int video_rx_port = -1, video_tx_port = -1, audio_rx_port = -1, audio_tx_port = -1;
bool echo_cancellation = false;
@@ -711,9 +713,10 @@ int main(int argc, char *argv[])
{"pix-fmts", no_argument, 0, OPT_PIX_FMTS},
{"video-codecs", no_argument, 0, OPT_VIDEO_CODECS},
{"nat-traverse", optional_argument, nullptr, 'N'},
+ {"ttl", required_argument, nullptr, 'T'},
{0, 0, 0, 0}
};
- const char *optstring = "d:t:m:r:s:v46c:hM:N::p:f:P:l:A:V";
+ const char *optstring = "d:t:m:r:s:v46c:hM:N::p:f:P:l:A:VT:";
const char *audio_protocol = "ultragrid_rtp";
const char *audio_protocol_opts = "";
@@ -1076,6 +1079,13 @@ int main(int argc, char *argv[])
case 'N':
nat_traverse_config = optarg == nullptr ? "" : optarg;
break;
+ case 'T':
+ requested_ttl = stoi(optarg);
+ if (requested_ttl < -1 || requested_ttl >= 255) {
+ LOG(LOG_LEVEL_ERROR) << "TTL must be in range [0..255] or -1!\n";
+ EXIT(EXIT_FAIL_USAGE);
+ }
+ break;
case '?':
default:
usage(uv_argv[0]);
@@ -1237,7 +1247,7 @@ int main(int argc, char *argv[])
audio_channel_map,
audio_scale, echo_cancellation, force_ip_version, requested_mcast_if,
audio_codec, bitrate, &audio_offset, &start_time,
- requested_mtu, exporter);
+ requested_mtu, requested_ttl, exporter);
if(!uv.audio) {
exit_uv(EXIT_FAIL_AUDIO);
goto cleanup;
@@ -1335,6 +1345,7 @@ int main(int argc, char *argv[])
//RTP
params["mtu"].i = requested_mtu;
+ params["ttl"].i = requested_ttl;
params["receiver"].str = requested_receiver;
params["rx_port"].i = video_rx_port;
params["tx_port"].i = video_tx_port;
diff --git a/src/video_capture/ug_input.cpp b/src/video_capture/ug_input.cpp
index 594b261fb..853d4092c 100644
--- a/src/video_capture/ug_input.cpp
+++ b/src/video_capture/ug_input.cpp
@@ -149,7 +149,7 @@ static int vidcap_ug_input_init(struct vidcap_params *cap_params, void **state)
"none", "embedded",
"ultragrid_rtp", "",
"none", NULL, NULL, audio_scale, false, 0, NULL, "PCM", RATE_UNLIMITED, NULL,
- &start_time, 1500, NULL);
+ &start_time, 1500, -1, NULL);
if (s->audio == nullptr) {
delete s;
return VIDCAP_INIT_FAIL;
diff --git a/src/video_rxtx/rtp.cpp b/src/video_rxtx/rtp.cpp
index 5865a3683..f23e9542a 100644
--- a/src/video_rxtx/rtp.cpp
+++ b/src/video_rxtx/rtp.cpp
@@ -88,7 +88,7 @@ struct response *rtp_video_rxtx::process_sender_message(struct msg_sender *msg,
m_network_devices = initialize_network(m_requested_receiver.c_str(),
m_recv_port_number,
m_send_port_number, m_participants, m_force_ip_version,
- m_requested_mcast_if);
+ m_requested_mcast_if, m_requested_ttl);
if (!m_network_devices) {
m_network_devices = old_devices;
m_requested_receiver = old_receiver;
@@ -115,7 +115,7 @@ struct response *rtp_video_rxtx::process_sender_message(struct msg_sender *msg,
}
m_network_devices = initialize_network(m_requested_receiver.c_str(), m_recv_port_number,
m_send_port_number, m_participants, m_force_ip_version,
- m_requested_mcast_if);
+ m_requested_mcast_if, m_requested_ttl);
if (!m_network_devices) {
m_network_devices = old_devices;
@@ -186,7 +186,7 @@ struct response *rtp_video_rxtx::process_sender_message(struct msg_sender *msg,
m_network_devices = initialize_network(m_requested_receiver.c_str(),
m_recv_port_number,
m_send_port_number, m_participants, m_force_ip_version,
- m_requested_mcast_if);
+ m_requested_mcast_if, m_requested_ttl);
if (!m_network_devices) {
m_network_devices = old_devices;
log_msg(LOG_LEVEL_ERROR, "[control] Unable to change SSRC!\n");
@@ -216,9 +216,10 @@ rtp_video_rxtx::rtp_video_rxtx(map const ¶ms) :
m_send_port_number = params.at("tx_port").i;
m_force_ip_version = params.at("force_ip_version").i;
m_requested_mcast_if = params.at("mcast_if").str;
+ m_requested_ttl = params.find("ttl") != params.end() ? params.at("ttl").i : -1;
if ((m_network_devices = initialize_network(m_requested_receiver.c_str(), m_recv_port_number, m_send_port_number,
- m_participants, m_force_ip_version, m_requested_mcast_if))
+ m_participants, m_force_ip_version, m_requested_mcast_if, m_requested_ttl))
== NULL) {
throw ug_runtime_error("Unable to open network", EXIT_FAIL_NETWORK);
} else {
@@ -287,11 +288,10 @@ void rtp_video_rxtx::display_buf_increase_warning(int size)
struct rtp **rtp_video_rxtx::initialize_network(const char *addrs, int recv_port_base,
int send_port_base, struct pdb *participants, int force_ip_version,
- const char *mcast_if)
+ const char *mcast_if, int ttl)
{
struct rtp **devices = NULL;
double rtcp_bw = 5 * 1024 * 1024; /* FIXME */
- int ttl = 255;
char *saveptr = NULL;
char *addr;
char *tmp;
@@ -299,13 +299,6 @@ struct rtp **rtp_video_rxtx::initialize_network(const char *addrs, int recv_port
int recv_port = recv_port_base;
int send_port = send_port_base;
- if (commandline_params.find("ttl") != commandline_params.end()) {
- ttl = stoi(commandline_params.at("ttl"));
- if (ttl < -1 || ttl > 255) {
- throw ug_runtime_error("TTL must be in range 0..255 or -1!");
- }
- }
-
tmp = strdup(addrs);
if(strtok_r(tmp, ",", &saveptr) == NULL) {
free(tmp);
diff --git a/src/video_rxtx/rtp.h b/src/video_rxtx/rtp.h
index 3b0938b3a..6594f9baa 100644
--- a/src/video_rxtx/rtp.h
+++ b/src/video_rxtx/rtp.h
@@ -63,7 +63,7 @@ public:
static struct rtp **initialize_network(const char *addrs, int recv_port_base,
int send_port_base, struct pdb *participants, int force_ip_version,
- const char *mcast_if);
+ const char *mcast_if, int ttl);
void destroy_rtp_devices(struct rtp ** network_devices);
static void display_buf_increase_warning(int size);
@@ -78,6 +78,7 @@ protected:
int m_send_port_number;
int m_force_ip_version;
const char *m_requested_mcast_if;
+ int m_requested_ttl;
fec *m_fec_state;
const std::chrono::steady_clock::time_point m_start_time;
video_desc m_video_desc;
diff --git a/src/video_rxtx/ultragrid_rtp.cpp b/src/video_rxtx/ultragrid_rtp.cpp
index 5fed70363..41479cf38 100644
--- a/src/video_rxtx/ultragrid_rtp.cpp
+++ b/src/video_rxtx/ultragrid_rtp.cpp
@@ -246,7 +246,7 @@ void ultragrid_rtp_video_rxtx::receiver_process_messages()
m_network_devices = initialize_network(m_requested_receiver.c_str(),
m_recv_port_number,
m_send_port_number, m_participants, m_force_ip_version,
- m_requested_mcast_if);
+ m_requested_mcast_if, m_requested_ttl);
if (!m_network_devices) {
log_msg(LOG_LEVEL_ERROR, "[control] Failed to change RX port to %d\n", msg->new_rx_port);
r = new_response(RESPONSE_INT_SERV_ERR, "Changing RX port failed!");