[vlc-commits] WIP: live555
Rémi Denis-Courmont
git at videolan.org
Sat Aug 6 21:12:03 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 6 19:19:40 2016 +0300| [1a966f080a00edef9ecbb49e769f462dab204811] | committer: Rémi Denis-Courmont
WIP: live555
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a966f080a00edef9ecbb49e769f462dab204811
---
modules/access/live555.cpp | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index bc5a9fa..ffca911 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -209,8 +209,8 @@ struct demux_sys_t
double f_npt_start;
/* timeout thread information */
- int i_timeout; /* session timeout value in seconds */
- bool b_timeout_call;/* mark to send an RTSP call to prevent server timeout */
+ mtime_t next_refresh;
+ unsigned interval; /* session timeout value in seconds */
timeout_thread_t *p_timeout; /* the actual thread that makes sure we don't timeout */
vlc_mutex_t timeout_mutex; /* Serialise calls to live555 in timeout thread w.r.t. Demux()/Control() */
@@ -1232,15 +1232,19 @@ static int Play( demux_t *p_demux )
}
/* Retrieve the timeout value and set up a timeout prevention thread */
- p_sys->i_timeout = p_sys->rtsp->sessionTimeoutParameter();
- if( p_sys->i_timeout <= 0 )
- p_sys->i_timeout = 60; /* default value from RFC2326 */
+ int interval = p_sys->rtsp->sessionTimeoutParameter();
+ if( interval <= 2 )
+ interval = 60; /* default value from RFC2326 */
+
+ p_sys->interval = interval - 2;
+ p_sys->next_refresh = mdate() + CLOCK_FREQ * interval;
/* start timeout-thread. GET_PARAMETER will be used if supported by
* the server. OPTIONS will be used as a fallback */
if( !p_sys->p_timeout )
{
- msg_Dbg( p_demux, "We have a timeout of %d seconds", p_sys->i_timeout );
+ msg_Dbg( p_demux, "We have a timeout of %u seconds",
+ p_sys->interval );
p_sys->p_timeout = (timeout_thread_t *)malloc( sizeof(timeout_thread_t) );
if( p_sys->p_timeout )
{
@@ -1288,7 +1292,7 @@ static int Demux( demux_t *p_demux )
vlc_mutex_locker locker(&p_sys->timeout_mutex);
/* Check if we need to send the server a Keep-A-Live signal */
- if( p_sys->b_timeout_call && p_sys->rtsp && p_sys->ms )
+ if( p_sys->rtsp && p_sys->ms && mdate() >= p_sys->next_refresh )
{
char *psz_bye = NULL;
/* Use GET_PARAMETERS if supported. wmserver dialect supports
@@ -1298,7 +1302,7 @@ static int Demux( demux_t *p_demux )
else
p_sys->rtsp->sendOptionsCommand(NULL, NULL);
- p_sys->b_timeout_call = false;
+ p_sys->next_refresh = mdate() + CLOCK_FREQ * p_sys->interval;
}
for( i = 0; i < p_sys->i_track; i++ )
@@ -2147,10 +2151,10 @@ static void* TimeoutPrevention( void *p_data )
}
vlc_restorecancel (canc);
+ p_sys->next_refresh = mdate() + CLOCK_FREQ * p_sys->interval;
}
- p_sys->b_timeout_call = !p_timeout->b_handle_keep_alive;
- msleep (((int64_t)p_sys->i_timeout - 2) * CLOCK_FREQ);
+ mwait(p_sys->next_refresh);
}
vlc_assert_unreachable(); /* dead code */
}
More information about the vlc-commits
mailing list