mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 00:40:25 +00:00
Parameter to force hostname resolving into IPv6
Currently hostnames are resloved into IPv4 addresses by default.
This commit is contained in:
@@ -120,7 +120,8 @@ typedef void (*audio_device_help_t)(void);
|
||||
|
||||
static void *audio_sender_thread(void *arg);
|
||||
static void *audio_receiver_thread(void *arg);
|
||||
static struct rtp *initialize_audio_network(char *addr, int recv_port, int send_port, struct pdb *participants);
|
||||
static struct rtp *initialize_audio_network(char *addr, int recv_port,
|
||||
int send_port, struct pdb *participants, bool use_ipv6);
|
||||
|
||||
static void audio_channel_map_usage(void);
|
||||
static void audio_scale_usage(void);
|
||||
@@ -158,7 +159,7 @@ static void audio_scale_usage(void)
|
||||
*/
|
||||
struct state_audio * audio_cfg_init(char *addrs, int recv_port, int send_port, char *send_cfg, char *recv_cfg,
|
||||
char *jack_cfg, char *fec_cfg, char *audio_channel_map, const char *audio_scale,
|
||||
bool echo_cancellation)
|
||||
bool echo_cancellation, bool use_ipv6)
|
||||
{
|
||||
struct state_audio *s = NULL;
|
||||
char *tmp, *unused = NULL;
|
||||
@@ -226,8 +227,8 @@ struct state_audio * audio_cfg_init(char *addrs, int recv_port, int send_port, c
|
||||
addr = strtok_r(tmp, ",", &unused);
|
||||
if ((s->audio_network_device =
|
||||
initialize_audio_network(addr, recv_port, send_port,
|
||||
s->audio_participants)) ==
|
||||
NULL) {
|
||||
s->audio_participants, use_ipv6)) ==
|
||||
NULL) {
|
||||
printf("Unable to open audio network\n");
|
||||
goto error;
|
||||
}
|
||||
@@ -342,13 +343,14 @@ void audio_done(struct state_audio *s)
|
||||
}
|
||||
}
|
||||
|
||||
static struct rtp *initialize_audio_network(char *addr, int recv_port, int send_port, struct pdb *participants) // GiX
|
||||
static struct rtp *initialize_audio_network(char *addr, int recv_port,
|
||||
int send_port, struct pdb *participants, bool use_ipv6) // GiX
|
||||
{
|
||||
struct rtp *r;
|
||||
double rtcp_bw = 1024 * 512; // FIXME: something about 5% for rtcp is said in rfc
|
||||
|
||||
r = rtp_init(addr, recv_port, send_port, 255, rtcp_bw, FALSE, rtp_recv_callback,
|
||||
(void *)participants);
|
||||
(void *)participants, use_ipv6);
|
||||
if (r != NULL) {
|
||||
pdb_add(participants, rtp_my_ssrc(r));
|
||||
rtp_set_option(r, RTP_OPT_WEAK_VALIDATION, TRUE);
|
||||
|
||||
@@ -72,7 +72,7 @@ audio_frame;
|
||||
|
||||
struct state_audio * audio_cfg_init(char *addrs, int recv_port, int send_port, char *send_cfg, char *recv_cfg,
|
||||
char *jack_cfg, char *fec_cfg, char *audio_channel_map, const char *audio_scale,
|
||||
bool echo_cancellation);
|
||||
bool echo_cancellation, bool use_ipv6);
|
||||
void audio_finish(struct state_audio *s);
|
||||
void audio_done(struct state_audio *s);
|
||||
void audio_join(struct state_audio *s);
|
||||
|
||||
31
src/main.c
31
src/main.c
@@ -171,6 +171,12 @@ int uv_argc;
|
||||
char **uv_argv;
|
||||
static struct state_uv *uv_state;
|
||||
|
||||
//
|
||||
// prototypes
|
||||
//
|
||||
static struct rtp **initialize_network(char *addrs, int recv_port_base,
|
||||
int send_port_base, struct pdb *participants, bool use_ipv6);
|
||||
|
||||
void list_video_display_devices(void);
|
||||
void list_video_capture_devices(void);
|
||||
struct display *initialize_video_display(const char *requested_display,
|
||||
@@ -221,7 +227,7 @@ static void usage(void)
|
||||
/* TODO -c -p -b are deprecated options */
|
||||
printf("\nUsage: uv [-d <display_device>] [-t <capture_device>] [-r <audio_playout>]\n");
|
||||
printf(" [-s <audio_caputre>] [-l <limit_bitrate>] "
|
||||
"[-m <mtu>] [-c] [-i]\n");
|
||||
"[-m <mtu>] [-c] [-i] [-6]\n");
|
||||
printf(" [-M <video_mode>] [-p <postprocess>] "
|
||||
"[-f <FEC_options>] [-P <port>]\n");
|
||||
printf(" address(es)\n\n");
|
||||
@@ -237,6 +243,10 @@ static void usage(void)
|
||||
printf("\n");
|
||||
printf("\t-i \tiHDTV compatibility mode\n");
|
||||
printf("\n");
|
||||
#ifdef HAVE_IPv6
|
||||
printf("\t-6 \tUse IPv6\n");
|
||||
printf("\n");
|
||||
#endif // HAVE_IPv6
|
||||
printf("\t-r <playback_device> \tAudio playback device (see '-r help')\n");
|
||||
printf("\n");
|
||||
printf("\t-s <capture_device> \tAudio capture device (see '-s help')\n");
|
||||
@@ -403,7 +413,8 @@ static void display_buf_increase_warning(int size)
|
||||
|
||||
}
|
||||
|
||||
static struct rtp **initialize_network(char *addrs, int recv_port_base, int send_port_base, struct pdb *participants)
|
||||
static struct rtp **initialize_network(char *addrs, int recv_port_base,
|
||||
int send_port_base, struct pdb *participants, bool use_ipv6)
|
||||
{
|
||||
struct rtp **devices = NULL;
|
||||
double rtcp_bw = 5 * 1024 * 1024; /* FIXME */
|
||||
@@ -442,7 +453,7 @@ static struct rtp **initialize_network(char *addrs, int recv_port_base, int send
|
||||
|
||||
devices[index] = rtp_init(addr, recv_port, send_port, ttl, rtcp_bw,
|
||||
FALSE, rtp_recv_callback,
|
||||
(void *)participants);
|
||||
(void *)participants, use_ipv6);
|
||||
if (devices[index] != NULL) {
|
||||
rtp_set_option(devices[index], RTP_OPT_WEAK_VALIDATION,
|
||||
TRUE);
|
||||
@@ -849,6 +860,7 @@ int main(int argc, char *argv[])
|
||||
char *audio_scale = "mixauto";
|
||||
|
||||
bool echo_cancellation = false;
|
||||
bool use_ipv6 = false;
|
||||
|
||||
int bitrate = 0;
|
||||
|
||||
@@ -877,6 +889,7 @@ int main(int argc, char *argv[])
|
||||
{"display", required_argument, 0, 'd'},
|
||||
{"capture", required_argument, 0, 't'},
|
||||
{"mtu", required_argument, 0, 'm'},
|
||||
{"ipv6", no_argument, 0, '6'},
|
||||
{"mode", required_argument, 0, 'M'},
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{"compress", required_argument, 0, 'c'},
|
||||
@@ -934,7 +947,7 @@ int main(int argc, char *argv[])
|
||||
init_lib_common();
|
||||
|
||||
while ((ch =
|
||||
getopt_long(argc, argv, "d:t:m:r:s:vc:ihj:M:p:f:P:l:", getopt_options,
|
||||
getopt_long(argc, argv, "d:t:m:r:s:v6c:ihj:M:p:f:P:l:", getopt_options,
|
||||
&option_index)) != -1) {
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
@@ -1013,7 +1026,9 @@ int main(int argc, char *argv[])
|
||||
return EXIT_FAIL_USAGE;
|
||||
}
|
||||
break;
|
||||
|
||||
case '6':
|
||||
use_ipv6 = true;
|
||||
break;
|
||||
case '?':
|
||||
break;
|
||||
case AUDIO_CHANNEL_MAP:
|
||||
@@ -1090,7 +1105,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
char *tmp_requested_fec = strdup(DEFAULT_AUDIO_FEC);
|
||||
uv->audio = audio_cfg_init (network_device, uv->recv_port_number + 2, uv->send_port_number + 2, audio_send, audio_recv, jack_cfg,
|
||||
tmp_requested_fec, audio_channel_map, audio_scale, echo_cancellation);
|
||||
tmp_requested_fec, audio_channel_map, audio_scale, echo_cancellation, use_ipv6);
|
||||
free(tmp_requested_fec);
|
||||
if(!uv->audio)
|
||||
goto cleanup;
|
||||
@@ -1210,7 +1225,9 @@ int main(int argc, char *argv[])
|
||||
sleep(1);
|
||||
} else {
|
||||
if ((uv->network_devices =
|
||||
initialize_network(network_device, uv->recv_port_number, uv->send_port_number, uv->participants)) == NULL) {
|
||||
initialize_network(network_device, uv->recv_port_number,
|
||||
uv->send_port_number, uv->participants, use_ipv6))
|
||||
== NULL) {
|
||||
printf("Unable to open network\n");
|
||||
exit_uv(EXIT_FAIL_NETWORK);
|
||||
goto cleanup_wait_display;
|
||||
|
||||
@@ -818,9 +818,9 @@ int udp_addr_valid(const char *addr)
|
||||
* Returns: a pointer to a valid socket_udp structure on success, NULL otherwise.
|
||||
**/
|
||||
socket_udp *udp_init(const char *addr, uint16_t rx_port, uint16_t tx_port,
|
||||
int ttl)
|
||||
int ttl, bool use_ipv6)
|
||||
{
|
||||
return udp_init_if(addr, NULL, rx_port, tx_port, ttl);
|
||||
return udp_init_if(addr, NULL, rx_port, tx_port, ttl, use_ipv6);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -838,11 +838,11 @@ socket_udp *udp_init(const char *addr, uint16_t rx_port, uint16_t tx_port,
|
||||
* Return value: a pointer to a socket_udp structure on success, NULL otherwise.
|
||||
**/
|
||||
socket_udp *udp_init_if(const char *addr, const char *iface, uint16_t rx_port,
|
||||
uint16_t tx_port, int ttl)
|
||||
uint16_t tx_port, int ttl, bool use_ipv6)
|
||||
{
|
||||
socket_udp *res;
|
||||
|
||||
if (strchr(addr, ':') == NULL) {
|
||||
if (strchr(addr, ':') == NULL && !use_ipv6) {
|
||||
res = udp_init4(addr, iface, rx_port, tx_port, ttl);
|
||||
} else {
|
||||
res = udp_init6(addr, iface, rx_port, tx_port, ttl);
|
||||
|
||||
@@ -46,8 +46,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
int udp_addr_valid(const char *addr);
|
||||
socket_udp *udp_init(const char *addr, uint16_t rx_port, uint16_t tx_port, int ttl);
|
||||
socket_udp *udp_init_if(const char *addr, const char *iface, uint16_t rx_port, uint16_t tx_port, int ttl);
|
||||
socket_udp *udp_init(const char *addr, uint16_t rx_port, uint16_t tx_port, int ttl, bool use_ipv6);
|
||||
socket_udp *udp_init_if(const char *addr, const char *iface, uint16_t rx_port, uint16_t tx_port, int ttl, bool use_ipv6);
|
||||
void udp_exit(socket_udp *s);
|
||||
|
||||
int udp_peek(socket_udp *s, char *buffer, int buflen);
|
||||
|
||||
@@ -1009,10 +1009,11 @@ static void init_rng(const char *s)
|
||||
struct rtp *rtp_init(const char *addr,
|
||||
uint16_t rx_port, uint16_t tx_port,
|
||||
int ttl, double rtcp_bw,
|
||||
int tfrc_on, rtp_callback callback, uint8_t * userdata)
|
||||
int tfrc_on, rtp_callback callback, uint8_t * userdata,
|
||||
bool use_ipv6)
|
||||
{
|
||||
return rtp_init_if(addr, NULL, rx_port, tx_port, ttl, rtcp_bw, tfrc_on,
|
||||
callback, userdata);
|
||||
callback, userdata, use_ipv6);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1041,7 +1042,8 @@ struct rtp *rtp_init(const char *addr,
|
||||
struct rtp *rtp_init_if(const char *addr, char *iface,
|
||||
uint16_t rx_port, uint16_t tx_port,
|
||||
int ttl, double rtcp_bw,
|
||||
int tfrc_on, rtp_callback callback, uint8_t * userdata)
|
||||
int tfrc_on, rtp_callback callback, uint8_t * userdata,
|
||||
bool use_ipv6)
|
||||
{
|
||||
struct rtp *session;
|
||||
int i, j;
|
||||
@@ -1070,10 +1072,10 @@ struct rtp *rtp_init_if(const char *addr, char *iface,
|
||||
session->rx_port = rx_port;
|
||||
session->tx_port = tx_port;
|
||||
session->ttl = min(ttl, 127);
|
||||
session->rtp_socket = udp_init_if(addr, iface, rx_port, tx_port, ttl);
|
||||
session->rtp_socket = udp_init_if(addr, iface, rx_port, tx_port, ttl, use_ipv6);
|
||||
session->rtcp_socket =
|
||||
udp_init_if(addr, iface, (uint16_t) (rx_port + 1),
|
||||
(uint16_t) (tx_port + 1), ttl);
|
||||
(uint16_t) (tx_port + 1), ttl, use_ipv6);
|
||||
|
||||
init_opt(session);
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@
|
||||
#ifndef __RTP_H__
|
||||
#define __RTP_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h" // bool
|
||||
#include "config_unix.h"
|
||||
#include "config_win32.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#define RTP_VERSION 2
|
||||
#define RTP_PACKET_HEADER_SIZE ((sizeof(char *) * 2) + sizeof(uint32_t *) + (2 * sizeof(int)))
|
||||
#define RTP_MAX_PACKET_LEN 9000
|
||||
@@ -206,13 +212,15 @@ rtp_t rtp_init(const char *addr,
|
||||
int ttl, double rtcp_bw,
|
||||
int tfrc_on,
|
||||
rtp_callback callback,
|
||||
uint8_t *userdata);
|
||||
uint8_t *userdata,
|
||||
bool use_ipv6);
|
||||
rtp_t rtp_init_if(const char *addr, char *iface,
|
||||
uint16_t rx_port, uint16_t tx_port,
|
||||
int ttl, double rtcp_bw,
|
||||
int tfrc_on,
|
||||
rtp_callback callback,
|
||||
uint8_t *userdata);
|
||||
uint8_t *userdata,
|
||||
bool use_ipv6);
|
||||
|
||||
void rtp_send_bye(struct rtp *session);
|
||||
void rtp_done(struct rtp *session);
|
||||
|
||||
Reference in New Issue
Block a user