Commit e8003df9 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Similar fixes

RTSP server supports IPv6 (refs #270)
parent d935e0c9
...@@ -911,19 +911,24 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -911,19 +911,24 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
if( p_sys->psz_destination ) if( p_sys->psz_destination )
{ {
char access[100]; char access[17];
char url[strlen( p_sys->psz_destination ) + 1 + 12 + 1]; char url[NI_MAXHOST + 7];
/* first try to create the access out */ /* first try to create the access out */
if( p_sys->i_ttl > 0 ) if( p_sys->i_ttl > 0 )
{ {
sprintf( access, "udp{raw,ttl=%d}", p_sys->i_ttl ); snprintf( access, sizeof( access ), "udp{raw,ttl=%d}",
p_sys->i_ttl );
access[sizeof( access ) - 1] = '\0';
} }
else else
{ strcpy( access, "udp{raw}" );
sprintf( access, "udp{raw}" );
} snprintf( url, sizeof( url ),
sprintf( url, "%s:%d", p_sys->psz_destination, i_port ); strchr( p_sys->psz_destination, ':' ) ? "[%s]:%d" : "%s:%d",
p_sys->psz_destination, i_port );
url[sizeof( url ) - 1] = '\0';
if( ( p_access = sout_AccessOutNew( p_sout, access, url ) ) == NULL ) if( ( p_access = sout_AccessOutNew( p_sout, access, url ) ) == NULL )
{ {
msg_Err( p_stream, "cannot create the access out for %s://%s", msg_Err( p_stream, "cannot create the access out for %s://%s",
......
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