Commit f83d9aea authored by Christophe Massiot's avatar Christophe Massiot

reordertp: no retx with multicast inputs

parent db9360e6
Changes between 2.2 and 2.3: Changes between 2.2 and 2.3:
---------------------------- ----------------------------
* Fix potential segfault in aggregartp * Fix potential segfault in aggregartp
* Do not do retx in reordertp with multicast inputs
Changes between 2.1 and 2.2: Changes between 2.1 and 2.2:
---------------------------- ----------------------------
......
/***************************************************************************** /*****************************************************************************
* aggregartp.c: split an RTP stream for several contribution links * aggregartp.c: split an RTP stream for several contribution links
***************************************************************************** *****************************************************************************
* Copyright (C) 2009, 2011, 2014-2015 VideoLAN * Copyright (C) 2009, 2011, 2014-2017 VideoLAN
* $Id$
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -345,10 +344,15 @@ int main( int i_argc, char **pp_argv ) ...@@ -345,10 +344,15 @@ int main( int i_argc, char **pp_argv )
while ( optind < i_argc ) while ( optind < i_argc )
{ {
bool b_multicast;
struct opensocket_opt opt;
memset(&opt, 0, sizeof(struct opensocket_opt));
opt.pb_multicast = &b_multicast;
p_outputs = realloc( p_outputs, ++i_nb_outputs * sizeof(output_t) ); p_outputs = realloc( p_outputs, ++i_nb_outputs * sizeof(output_t) );
p_outputs[i_nb_outputs - 1].i_fd = i_fd = p_outputs[i_nb_outputs - 1].i_fd = i_fd =
OpenSocket( pp_argv[optind++], i_ttl, 0, DEFAULT_PORT, OpenSocket( pp_argv[optind++], i_ttl, 0, DEFAULT_PORT,
&p_outputs[i_nb_outputs - 1].i_weight, NULL, NULL ); &p_outputs[i_nb_outputs - 1].i_weight, NULL, &opt );
if ( p_outputs[i_nb_outputs - 1].i_fd == -1 ) if ( p_outputs[i_nb_outputs - 1].i_fd == -1 )
{ {
msg_Err( NULL, "unable to open output socket" ); msg_Err( NULL, "unable to open output socket" );
...@@ -359,7 +363,7 @@ int main( int i_argc, char **pp_argv ) ...@@ -359,7 +363,7 @@ int main( int i_argc, char **pp_argv )
p_outputs[i_nb_outputs - 1].i_remainder = 0; p_outputs[i_nb_outputs - 1].i_remainder = 0;
i_max_weight += p_outputs[i_nb_outputs - 1].i_weight; i_max_weight += p_outputs[i_nb_outputs - 1].i_weight;
if ( i_retx_fd == -1 ) if ( i_retx_fd == -1 && !b_multicast )
{ {
ADD_RETX ADD_RETX
} }
......
/***************************************************************************** /*****************************************************************************
* reordertp.c: rebuild an RTP stream from several aggregated links * reordertp.c: rebuild an RTP stream from several aggregated links
***************************************************************************** *****************************************************************************
* Copyright (C) 2009, 2011, 2014-2015 VideoLAN * Copyright (C) 2009, 2011, 2014-2017 VideoLAN
* $Id$
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -72,6 +71,7 @@ typedef struct input_t ...@@ -72,6 +71,7 @@ typedef struct input_t
{ {
int i_fd; int i_fd;
bool b_tcp; bool b_tcp;
bool b_multicast;
block_t *p_block; block_t *p_block;
sockaddr_t peer; sockaddr_t peer;
} input_t; } input_t;
...@@ -241,7 +241,8 @@ static int RetxGetFd(sockaddr_t **pp_sockaddr) ...@@ -241,7 +241,8 @@ static int RetxGetFd(sockaddr_t **pp_sockaddr)
i_nb_tries++; i_nb_tries++;
i_last_retx_input++; i_last_retx_input++;
i_last_retx_input %= i_nb_inputs; i_last_retx_input %= i_nb_inputs;
if ( p_inputs[i_last_retx_input].peer.so.sa_family != AF_UNSPEC ) if ( p_inputs[i_last_retx_input].peer.so.sa_family != AF_UNSPEC &&
!p_inputs[i_last_retx_input].b_multicast )
break; break;
} }
...@@ -445,11 +446,13 @@ int main( int i_argc, char **pp_argv ) ...@@ -445,11 +446,13 @@ int main( int i_argc, char **pp_argv )
struct pollfd *pfd = NULL; struct pollfd *pfd = NULL;
int i_fd; int i_fd;
bool b_tcp; bool b_tcp;
bool b_multicast = false;
#define ADD_INPUT \ #define ADD_INPUT \
p_inputs = realloc( p_inputs, ++i_nb_inputs * sizeof(input_t) ); \ p_inputs = realloc( p_inputs, ++i_nb_inputs * sizeof(input_t) ); \
p_inputs[i_nb_inputs - 1].i_fd = i_fd; \ p_inputs[i_nb_inputs - 1].i_fd = i_fd; \
p_inputs[i_nb_inputs - 1].b_tcp = b_tcp; \ p_inputs[i_nb_inputs - 1].b_tcp = b_tcp; \
p_inputs[i_nb_inputs - 1].b_multicast = b_multicast; \
p_inputs[i_nb_inputs - 1].p_block = NULL; \ p_inputs[i_nb_inputs - 1].p_block = NULL; \
p_inputs[i_nb_inputs - 1].peer.so.sa_family = AF_UNSPEC; \ p_inputs[i_nb_inputs - 1].peer.so.sa_family = AF_UNSPEC; \
pfd = realloc( pfd, i_nb_inputs * sizeof(struct pollfd) ); \ pfd = realloc( pfd, i_nb_inputs * sizeof(struct pollfd) ); \
...@@ -533,8 +536,12 @@ int main( int i_argc, char **pp_argv ) ...@@ -533,8 +536,12 @@ int main( int i_argc, char **pp_argv )
while ( optind < i_argc - 1 ) while ( optind < i_argc - 1 )
{ {
struct opensocket_opt opt;
memset(&opt, 0, sizeof(struct opensocket_opt));
opt.pb_multicast = &b_multicast;
i_fd = OpenSocket( pp_argv[optind], 0, DEFAULT_PORT, 0, NULL, i_fd = OpenSocket( pp_argv[optind], 0, DEFAULT_PORT, 0, NULL,
&b_tcp, NULL ); &b_tcp, &opt );
if ( i_fd == -1 ) if ( i_fd == -1 )
{ {
msg_Err( NULL, "unable to open input %s\n", pp_argv[optind] ); msg_Err( NULL, "unable to open input %s\n", pp_argv[optind] );
......
...@@ -555,7 +555,7 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint16_t i_bind_port, ...@@ -555,7 +555,7 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint16_t i_bind_port,
socklen_t i_sockaddr_len; socklen_t i_sockaddr_len;
bool b_host = false; bool b_host = false;
bool b_raw_packets = false; bool b_raw_packets = false;
in_addr_t i_raw_srcaddr = INADDR_ANY; in_addr_t i_raw_srcaddr = INADDR_ANY;
int i_raw_srcport = 0; int i_raw_srcport = 0;
char *psz_ifname = NULL; char *psz_ifname = NULL;
#ifdef __FreeBSD__ #ifdef __FreeBSD__
...@@ -569,6 +569,9 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint16_t i_bind_port, ...@@ -569,6 +569,9 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint16_t i_bind_port,
pb_tcp = &b_tcp; pb_tcp = &b_tcp;
*pb_tcp = false; *pb_tcp = false;
if ( p_opt != NULL && p_opt->pb_multicast != NULL )
*p_opt->pb_multicast = false;
psz_token2 = strrchr( psz_arg, ',' ); psz_token2 = strrchr( psz_arg, ',' );
if ( psz_token2 ) if ( psz_token2 )
{ {
...@@ -780,6 +783,9 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint16_t i_bind_port, ...@@ -780,6 +783,9 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint16_t i_bind_port,
&connect_addr ); &connect_addr );
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if ( p_opt != NULL && p_opt->pb_multicast != NULL )
*p_opt->pb_multicast = true;
} }
else else
#endif #endif
...@@ -882,6 +888,9 @@ normal_bind: ...@@ -882,6 +888,9 @@ normal_bind:
} }
#endif #endif
} }
if ( p_opt != NULL && p_opt->pb_multicast != NULL )
*p_opt->pb_multicast = true;
} }
if ( connect_addr.ss.ss_family != AF_UNSPEC ) if ( connect_addr.ss.ss_family != AF_UNSPEC )
......
...@@ -76,6 +76,7 @@ struct udprawpkt { ...@@ -76,6 +76,7 @@ struct udprawpkt {
*****************************************************************************/ *****************************************************************************/
struct opensocket_opt { struct opensocket_opt {
struct udprawpkt *p_raw_pktheader; struct udprawpkt *p_raw_pktheader;
bool *pb_multicast;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment