}
var_Get( p_stream, SOUT_CFG_PREFIX "ttl", &val );
- if( ( val.i_int > 255 ) || ( val.i_int < 0 ) )
+ if( val.i_int == 0 )
+ {
+ /* Normally, we should let the default hop limit up to the core,
+ * 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
+ * ttl are set. */
+ val.i_int = config_getInt( p_stream, "ttl" );
+ }
+ if( p_sys->i_ttl > 255 ) p_sys->i_ttl = 255;
+ /* must not exceed 999 once formatted */
+
+ if( p_sys->i_ttl < 0 )
{
msg_Err( p_stream, "illegal TTL %d", val.i_int );
free( p_sys );
RTP packets need to get the correct src IP address */
if( net_AddressIsMulticast( (vlc_object_t *)p_stream, p_sys->psz_destination ) )
{
- snprintf( psz_ttl, sizeof( psz_ttl ), "/%d", p_sys->i_ttl ?
- p_sys->i_ttl : config_GetInt( p_sout, "ttl" ) );
+ snprintf( psz_ttl, sizeof( psz_ttl ), "/%d", p_sys->i_ttl );
psz_ttl[sizeof( psz_ttl ) - 1] = '\0';
}
else
if( net_AddressIsMulticast( (vlc_object_t *)p_stream, psz_destination ) )
{
/* Add the ttl if it is a multicast address */
- p += sprintf( p, "/%d\r\n", p_sys->i_ttl ? p_sys->i_ttl :
- config_GetInt( p_sout, "ttl" ) );
+ p += sprintf( p, "/%d\r\n", p_sys->i_ttl );
}
else
{
httpd_MsgAdd( answer, "Transport",
"RTP/AVP/UDP;destination=%s;port=%d-%d;ttl=%d",
id->psz_destination, id->i_port,id->i_port+1,
- p_sys->i_ttl ? p_sys->i_ttl :
- config_GetInt( p_sout, "ttl" ) );
+ p_sys->i_ttl );
}
else if( strstr( psz_transport, "unicast" ) && strstr( psz_transport, "client_port=" ) )
{