Commit f350eb53 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Patch by Glen Gray: RTSP keep alive fix. If the server doesn't handle RTCP-RR...

Patch by Glen Gray: RTSP keep alive fix. If the server doesn't handle RTCP-RR packets and requires specific GET_PARAMETER commands (such as Kasenna) then the session times out when vlc is paused because the current version only sends the info when Demux() is called. Demux() is only called when data is received. This patch fixes this issue with a boolean that is set during PAUSED state that allows the timer thread to send the GET_PARAMTER messages instead and thus keeping the RTSP session alive.
parent 33f2e095
......@@ -70,6 +70,7 @@ Frank Chao <frank0624 at gmail.com> - Chinese Traditional translation
Fumio Nakayama <endymion at ca2.so-net.ne.jp> - Japanese translation
Gabor Kelemen <kelemeng at gnome.hu> - Hungarian translation
Georgi Chorbadzhiyski <gf at unixsol dot org> - HTTP access error handling fix
Glen Gray <slaine at slaine dot org> - RTSP Keepalive fixes
Greg Farrell <greg at gregfarell dot org> - rc interface "enqueue" command
Gregory Hazel <ghazel at gmail dot com> - wxWidgets fixes and improvements
Goetz Waschk <waschk at informatik.uni-rostock dot de> - Mandrake packages
......
......@@ -153,6 +153,7 @@ struct timeout_thread_t
VLC_COMMON_MEMBERS
int64_t i_remain;
vlc_bool_t b_handle_keep_alive;
demux_sys_t *p_sys;
};
......@@ -1163,6 +1164,19 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
msg_Err( p_demux, "PLAY or PAUSE failed %s", p_sys->env->getResultMsg() );
return VLC_EGENERIC;
}
/* When we Pause, we'll need the TimeoutPrevention thread to
* handle sending the "Keep Alive" message to the server.
* Unfortunately Live555 isn't thread safe and so can't
* do this normally while the main Demux thread is handling
* a live stream. We end up with the Timeout thread blocking
* waiting for a response from the server. So when we PAUSE
* we set a flag that the TimeoutPrevention function will check
* and if it's set, it will trigger the GET_PARAMETER message */
if( b_bool && p_sys->p_timeout != NULL )
p_sys->p_timeout->b_handle_keep_alive = VLC_TRUE;
else if( !b_bool && p_sys->p_timeout != NULL )
p_sys->p_timeout->b_handle_keep_alive = VLC_FALSE;
#if 0
/* reset PCR and PCR start, mmh won't work well for multi-stream I fear */
for( i = 0; i < p_sys->i_track; i++ )
......@@ -1510,10 +1524,21 @@ static void TimeoutPrevention( timeout_thread_t *p_timeout )
{
if( p_timeout->i_remain <= 0 )
{
char *psz_bye = NULL;
p_timeout->i_remain = (int64_t)p_timeout->p_sys->i_timeout -2;
p_timeout->i_remain *= 1000000;
p_timeout->p_sys->b_timeout_call = VLC_TRUE;
msg_Dbg( p_timeout, "reset the timeout timer" );
if( p_timeout->b_handle_keep_alive == VLC_TRUE)
{
#if LIVEMEDIA_LIBRARY_VERSION_INT >= 1138089600
p_timeout->p_sys->rtsp->getMediaSessionParameter( *p_timeout->p_sys->ms, NULL, psz_bye );
#endif
p_timeout->p_sys->b_timeout_call = VLC_FALSE;
}
else
{
p_timeout->p_sys->b_timeout_call = VLC_TRUE;
}
}
p_timeout->i_remain -= 200000;
msleep( 200000 ); /* 200 ms */
......
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