Commit f2eb5c01 authored by Dennis van Amerongen's avatar Dennis van Amerongen

* modules/access_output/shout.c: backport [23318] auto reconnect on startup.

parent e5da39a5
...@@ -215,7 +215,27 @@ static int Open( vlc_object_t *p_this ) ...@@ -215,7 +215,27 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* Shoutcast using ICY protocol */ /* Connect at startup. Cycle through the possible protocols. */
i_ret = shout_get_connected( p_shout );
while ( i_ret != SHOUTERR_CONNECTED )
{
/* Shout parameters cannot be changed on an open connection */
i_ret = shout_close( p_shout );
if( i_ret == SHOUTERR_SUCCESS )
{
i_ret = SHOUTERR_UNCONNECTED;
}
/* Re-initialize for Shoutcast using ICY protocol. Not needed for initial connection
but it is when we are reconnecting after other protocol was tried. */
i_ret = shout_set_protocol( p_shout, SHOUT_PROTOCOL_ICY );
if( i_ret != SHOUTERR_SUCCESS )
{
msg_Err( p_access, "failed to set the protocol to 'icy'" );
free( p_access->p_sys );
free( psz_accessname );
return VLC_EGENERIC;
}
i_ret = shout_open( p_shout ); i_ret = shout_open( p_shout );
if( i_ret == SHOUTERR_SUCCESS ) if( i_ret == SHOUTERR_SUCCESS )
{ {
...@@ -242,7 +262,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -242,7 +262,6 @@ static int Open( vlc_object_t *p_this )
free( psz_accessname ); free( psz_accessname );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
i_ret = shout_open( p_shout ); i_ret = shout_open( p_shout );
if( i_ret == SHOUTERR_SUCCESS ) if( i_ret == SHOUTERR_SUCCESS )
{ {
...@@ -252,7 +271,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -252,7 +271,6 @@ static int Open( vlc_object_t *p_this )
else else
msg_Warn( p_access, "failed to connect using 'http' (icecast 2.x) protocol " ); msg_Warn( p_access, "failed to connect using 'http' (icecast 2.x) protocol " );
} }
/* /*
for non-blocking, use: for non-blocking, use:
while( i_ret == SHOUTERR_BUSY ) while( i_ret == SHOUTERR_BUSY )
...@@ -261,6 +279,14 @@ static int Open( vlc_object_t *p_this ) ...@@ -261,6 +279,14 @@ static int Open( vlc_object_t *p_this )
i_ret = shout_get_connected( p_shout ); i_ret = shout_get_connected( p_shout );
} }
*/ */
/* Only wait when we have no connection */
if ( i_ret != SHOUTERR_CONNECTED )
{
msg_Warn( p_access, "unable to establish connection. waiting 30 seconds to retry..." );
msleep( 30000000 );
}
}
if( i_ret != SHOUTERR_CONNECTED ) if( i_ret != SHOUTERR_CONNECTED )
{ {
msg_Err( p_access, "failed to open shout stream to %s:%i/%s: %s", msg_Err( p_access, "failed to open shout stream to %s:%i/%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