[vlc-commits] service_discovery:sap: store the timeout as vlc_tick_t
Steve Lhomme
git at videolan.org
Tue Sep 18 15:56:06 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jun 13 11:37:24 2018 +0200| [3a43ab67e4f0fe1b7ab15375d52ab089cf1d807f] | committer: Steve Lhomme
service_discovery:sap: store the timeout as vlc_tick_t
Using vlc_tick_from_sec()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3a43ab67e4f0fe1b7ab15375d52ab089cf1d807f
---
modules/services_discovery/sap.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index ed0f99abd0..adeab5a11b 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -227,7 +227,7 @@ typedef struct
bool b_strict;
bool b_parse;
- int i_timeout;
+ vlc_tick_t i_timeout;
} services_discovery_sys_t;
typedef struct
@@ -293,7 +293,7 @@ static int Open( vlc_object_t *p_this )
if( !p_sys )
return VLC_ENOMEM;
- p_sys->i_timeout = var_CreateGetInteger( p_sd, "sap-timeout" );
+ p_sys->i_timeout = vlc_tick_from_sec(var_CreateGetInteger( p_sd, "sap-timeout" ));
p_sd->p_sys = p_sys;
p_sd->description = _("Network streams (SAP)");
@@ -574,7 +574,6 @@ static void *Run( void *data )
/* Check for items that need deletion */
for( int i = 0; i < p_sys->i_announces; i++ )
{
- vlc_tick_t i_timeout = vlc_tick_from_sec( p_sys->i_timeout );
sap_announce_t * p_announce = p_sys->pp_announces[i];
vlc_tick_t i_last_period = now - p_announce->i_last;
@@ -582,7 +581,7 @@ static void *Run( void *data )
* or if the last packet emitted was 10 times the average time
* between two packets */
if( ( p_announce->i_period_trust > 5 && i_last_period > 10 * p_announce->i_period ) ||
- i_last_period > i_timeout )
+ i_last_period > p_sys->i_timeout )
{
RemoveAnnounce( p_sd, p_announce );
}
@@ -591,7 +590,7 @@ static void *Run( void *data )
/* Compute next timeout */
if( p_announce->i_period_trust > 5 )
timeout = __MIN((10 * p_announce->i_period - i_last_period) / 1000, timeout);
- timeout = __MIN((i_timeout - i_last_period)/1000, timeout);
+ timeout = __MIN((p_sys->i_timeout - i_last_period)/1000, timeout);
}
}
More information about the vlc-commits
mailing list