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:
----------------------------
* Fix potential segfault in aggregartp
* Do not do retx in reordertp with multicast inputs
Changes between 2.1 and 2.2:
----------------------------
......
/*****************************************************************************
* aggregartp.c: split an RTP stream for several contribution links
*****************************************************************************
* Copyright (C) 2009, 2011, 2014-2015 VideoLAN
* $Id$
* Copyright (C) 2009, 2011, 2014-2017 VideoLAN
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -345,10 +344,15 @@ int main( int i_argc, char **pp_argv )
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[i_nb_outputs - 1].i_fd = i_fd =
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 )
{
msg_Err( NULL, "unable to open output socket" );
......@@ -359,7 +363,7 @@ int main( int i_argc, char **pp_argv )
p_outputs[i_nb_outputs - 1].i_remainder = 0;
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
}
......
/*****************************************************************************
* reordertp.c: rebuild an RTP stream from several aggregated links
*****************************************************************************
* Copyright (C) 2009, 2011, 2014-2015 VideoLAN
* $Id$
* Copyright (C) 2009, 2011, 2014-2017 VideoLAN
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -72,6 +71,7 @@ typedef struct input_t
{
int i_fd;
bool b_tcp;
bool b_multicast;
block_t *p_block;
sockaddr_t peer;
} input_t;
......@@ -241,7 +241,8 @@ static int RetxGetFd(sockaddr_t **pp_sockaddr)
i_nb_tries++;
i_last_retx_input++;
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;
}
......@@ -445,11 +446,13 @@ int main( int i_argc, char **pp_argv )
struct pollfd *pfd = NULL;
int i_fd;
bool b_tcp;
bool b_multicast = false;
#define ADD_INPUT \
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].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].peer.so.sa_family = AF_UNSPEC; \
pfd = realloc( pfd, i_nb_inputs * sizeof(struct pollfd) ); \
......@@ -533,8 +536,12 @@ int main( int i_argc, char **pp_argv )
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,
&b_tcp, NULL );
&b_tcp, &opt );
if ( i_fd == -1 )
{
msg_Err( NULL, "unable to open input %s\n", pp_argv[optind] );
......
......@@ -569,6 +569,9 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint16_t i_bind_port,
pb_tcp = &b_tcp;
*pb_tcp = false;
if ( p_opt != NULL && p_opt->pb_multicast != NULL )
*p_opt->pb_multicast = false;
psz_token2 = strrchr( psz_arg, ',' );
if ( psz_token2 )
{
......@@ -780,6 +783,9 @@ int OpenSocket( const char *_psz_arg, int i_ttl, uint16_t i_bind_port,
&connect_addr );
exit(EXIT_FAILURE);
}
if ( p_opt != NULL && p_opt->pb_multicast != NULL )
*p_opt->pb_multicast = true;
}
else
#endif
......@@ -882,6 +888,9 @@ normal_bind:
}
#endif
}
if ( p_opt != NULL && p_opt->pb_multicast != NULL )
*p_opt->pb_multicast = true;
}
if ( connect_addr.ss.ss_family != AF_UNSPEC )
......
......@@ -76,6 +76,7 @@ struct udprawpkt {
*****************************************************************************/
struct opensocket_opt {
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