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

- Fix typo in previous commit

- Enforce a default TTL value (one) in SDP if there is none - refs #404
  (it should at least be fine for IPv4 usage)
parent d3db2d9e
...@@ -361,7 +361,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -361,7 +361,7 @@ static int Open( vlc_object_t *p_this )
* but we have to know it to build our SDP properly, which is why * but we have to know it to build our SDP properly, which is why
* we ask the core. FIXME: broken when neither sout-rtp-ttl nor * we ask the core. FIXME: broken when neither sout-rtp-ttl nor
* ttl are set. */ * ttl are set. */
val.i_int = config_getInt( p_stream, "ttl" ); val.i_int = config_GetInt( p_stream, "ttl" );
} }
if( p_sys->i_ttl > 255 ) p_sys->i_ttl = 255; if( p_sys->i_ttl > 255 ) p_sys->i_ttl = 255;
/* must not exceed 999 once formatted */ /* must not exceed 999 once formatted */
...@@ -454,6 +454,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -454,6 +454,7 @@ static int Open( vlc_object_t *p_this )
url[sizeof( url ) - 1] = '\0'; url[sizeof( url ) - 1] = '\0';
/* FIXME: we should check that url is a numerical address, otherwise /* FIXME: we should check that url is a numerical address, otherwise
* the SDP will be quite broken (regardless of the IP protocol version) * the SDP will be quite broken (regardless of the IP protocol version)
* Also it might be IPv6 with no ':' if it is a DNS name.
*/ */
ipv = ( strchr( p_sys->psz_destination, ':' ) != NULL ) ? '6' : '4'; ipv = ( strchr( p_sys->psz_destination, ':' ) != NULL ) ? '6' : '4';
...@@ -814,7 +815,8 @@ static char *SDPGenerate( const sout_stream_t *p_stream, ...@@ -814,7 +815,8 @@ static char *SDPGenerate( const sout_stream_t *p_stream,
if( net_AddressIsMulticast( (vlc_object_t *)p_stream, psz_destination ) ) if( net_AddressIsMulticast( (vlc_object_t *)p_stream, psz_destination ) )
{ {
/* Add the ttl if it is a multicast address */ /* Add the ttl if it is a multicast address */
p += sprintf( p, "/%d\r\n", p_sys->i_ttl ); /* FIXME: 1 is not a correct default value in the case of IPv6 */
p += sprintf( p, "/%d\r\n", p_sys->i_ttl ?: 1 );
} }
else else
{ {
...@@ -942,7 +944,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -942,7 +944,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
char url[NI_MAXHOST + 8]; char url[NI_MAXHOST + 8];
/* 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 )
{ {
snprintf( access, sizeof( access ), "udp{raw,ttl=%d}", snprintf( access, sizeof( access ), "udp{raw,ttl=%d}",
p_sys->i_ttl ); p_sys->i_ttl );
...@@ -1712,7 +1714,7 @@ static int RtspCallbackId( httpd_callback_sys_t *p_args, ...@@ -1712,7 +1714,7 @@ static int RtspCallbackId( httpd_callback_sys_t *p_args,
} }
/* 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 )
snprintf( psz_access, sizeof( psz_access ), snprintf( psz_access, sizeof( psz_access ),
"udp{raw,ttl=%d}", p_sys->i_ttl ); "udp{raw,ttl=%d}", p_sys->i_ttl );
else else
......
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