From: Arnaud de Bossoreille de Ribou Date: Tue, 8 May 2001 12:53:30 +0000 (+0000) Subject: - fix a bug in ts input. X-Git-Tag: 0.2.81~130 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6bdefd98979ab40b44ffb8dd891768d068c7c338;p=vlc - fix a bug in ts input. Henri: a 0.5s timeout is not (time_t)0.5 sec and (time_t)0 usec but (time_t)0 sec and (time_t)500000 usec Now the input doesn't eat all the cpu any more :p --- diff --git a/plugins/mpeg/input_ts.c b/plugins/mpeg/input_ts.c index 854569bc3d..45b1e635ce 100644 --- a/plugins/mpeg/input_ts.c +++ b/plugins/mpeg/input_ts.c @@ -2,7 +2,7 @@ * input_ts.c: TS demux and netlist management ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: input_ts.c,v 1.18 2001/05/07 04:35:21 henri Exp $ + * $Id: input_ts.c,v 1.19 2001/05/08 12:53:30 bozo Exp $ * * Authors: Henri Fallon * @@ -260,6 +260,14 @@ static int TSRead( input_thread_t * p_input, struct timeval s_wait; + /* Get iovecs */ + p_iovec = input_NetlistGetiovec( p_input->p_method_data ); + + if ( p_iovec == NULL ) + { + return( -1 ); /* empty netlist */ + } + /* Init */ p_method = ( thread_ts_data_t * )p_input->p_plugin_data; @@ -269,20 +277,12 @@ static int TSRead( input_thread_t * p_input, /* We'll wait 0.5 second if nothing happens */ - s_wait.tv_sec = 0.5; - s_wait.tv_usec = 0; + s_wait.tv_sec = 0; + s_wait.tv_usec = 500000; /* Reset pointer table */ memset( pp_packets, 0, INPUT_READ_ONCE * sizeof(data_packet_t *) ); - /* Get iovecs */ - p_iovec = input_NetlistGetiovec( p_input->p_method_data ); - - if ( p_iovec == NULL ) - { - return( -1 ); /* empty netlist */ - } - /* Fill if some data is available */ i_data = select(p_input->i_handle + 1, &(p_method->s_fdset), NULL, NULL, &s_wait);