mirror of
https://github.com/videolan/vlc.git
synced 2024-12-05 07:46:32 +08:00
* src/misc/darwin_specific.m: Partial attempt at fixing a memory leak,
* input: new b_connected field, allowing to correctly detect the EOF of TCP streams (closes #35), * input: fixed a deadlock when opening a zero-sized file, * input: fixed a deadlock when opening an unconnected FIFO (closes #54).
This commit is contained in:
parent
afbc560297
commit
d3c3b323b7
@ -4,7 +4,7 @@
|
||||
* control the pace of reading.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999, 2000 VideoLAN
|
||||
* $Id: input_ext-intf.h,v 1.81 2002/12/12 15:10:58 gbazin Exp $
|
||||
* $Id: input_ext-intf.h,v 1.82 2002/12/31 01:54:35 massiot Exp $
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
*
|
||||
@ -219,6 +219,7 @@ struct stream_descriptor_t
|
||||
disc or network */
|
||||
vlc_bool_t b_pace_control; /* can we read when we want ? */
|
||||
vlc_bool_t b_seekable; /* can we do lseek() ? */
|
||||
vlc_bool_t b_connected; /* does read() == 0 imply EOF ? */
|
||||
|
||||
/* if (b_seekable) : */
|
||||
unsigned int i_area_nb;
|
||||
|
@ -72,9 +72,12 @@
|
||||
* Input thread configuration
|
||||
*****************************************************************************/
|
||||
|
||||
/* XXX?? */
|
||||
/* Used in ErrorThread */
|
||||
#define INPUT_IDLE_SLEEP ((mtime_t)(0.100*CLOCK_FREQ))
|
||||
|
||||
/* Time to wait in case of read error */
|
||||
#define INPUT_ERROR_SLEEP ((mtime_t)(0.10*CLOCK_FREQ))
|
||||
|
||||
/*
|
||||
* General limitations
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@
|
||||
* -udf.* to find files
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2001 VideoLAN
|
||||
* $Id: access.c,v 1.7 2002/12/30 23:45:21 massiot Exp $
|
||||
* $Id: access.c,v 1.8 2002/12/31 01:54:35 massiot Exp $
|
||||
*
|
||||
* Author: Stéphane Borel <stef@via.ecp.fr>
|
||||
*
|
||||
@ -191,6 +191,7 @@ int E_(DVDOpen) ( vlc_object_t *p_this )
|
||||
p_input->stream.i_method = INPUT_METHOD_DVD;
|
||||
p_input->stream.b_pace_control = 1;
|
||||
p_input->stream.b_seekable = 1;
|
||||
p_input->stream.b_connected = 1;
|
||||
p_input->stream.p_selected_area->i_size = 0;
|
||||
p_input->stream.p_selected_area->i_tell = 0;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* access.c: access capabilities for dvdplay plugin.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001 VideoLAN
|
||||
* $Id: access.c,v 1.8 2002/12/13 01:50:32 gbazin Exp $
|
||||
* $Id: access.c,v 1.9 2002/12/31 01:54:35 massiot Exp $
|
||||
*
|
||||
* Author: Stéphane Borel <stef@via.ecp.fr>
|
||||
*
|
||||
@ -133,6 +133,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
|
||||
p_input->stream.b_pace_control = 1;
|
||||
/* seek is only allowed when we have size info */
|
||||
p_input->stream.b_seekable = 0;
|
||||
p_input->stream.b_connected = 1;
|
||||
|
||||
/* Initialize ES structures */
|
||||
input_InitStream( p_input, sizeof( stream_ps_data_t ) );
|
||||
|
@ -6,7 +6,7 @@
|
||||
* It depends on: libdvdread for ifo files and block reading.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001 VideoLAN
|
||||
* $Id: input.c,v 1.10 2002/12/30 23:45:21 massiot Exp $
|
||||
* $Id: input.c,v 1.11 2002/12/31 01:54:35 massiot Exp $
|
||||
*
|
||||
* Author: Stéphane Borel <stef@via.ecp.fr>
|
||||
*
|
||||
@ -362,6 +362,7 @@ int E_(OpenDVD) ( vlc_object_t *p_this )
|
||||
/* If we are here we can control the pace... */
|
||||
p_input->stream.b_pace_control = 1;
|
||||
p_input->stream.b_seekable = 1;
|
||||
p_input->stream.b_connected = 1;
|
||||
|
||||
p_input->stream.p_selected_area->i_size = 0;
|
||||
p_input->stream.p_selected_area->i_tell = 0;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* file.c: file input (file: access plug-in)
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001, 2002 VideoLAN
|
||||
* $Id: file.c,v 1.6 2002/12/12 15:10:58 gbazin Exp $
|
||||
* $Id: file.c,v 1.7 2002/12/31 01:54:35 massiot Exp $
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
*
|
||||
@ -113,6 +113,7 @@ static int Open( vlc_object_t *p_this )
|
||||
|
||||
vlc_mutex_lock( &p_input->stream.stream_lock );
|
||||
|
||||
p_input->stream.b_connected = 1;
|
||||
if( *p_input->psz_access && !strncmp( p_input->psz_access, "stream", 7 ) )
|
||||
{
|
||||
/* stream:%s */
|
||||
@ -198,7 +199,7 @@ static int Open( vlc_object_t *p_this )
|
||||
GetFileSize( (HANDLE)p_access_data->i_handle, NULL );
|
||||
#else
|
||||
p_access_data->i_handle = open( psz_name,
|
||||
/*O_NONBLOCK | O_LARGEFILE*/ 0 );
|
||||
O_NONBLOCK /*| O_LARGEFILE*/ );
|
||||
if( p_access_data->i_handle == -1 )
|
||||
{
|
||||
# ifdef HAVE_ERRNO_H
|
||||
@ -213,6 +214,14 @@ static int Open( vlc_object_t *p_this )
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( p_input->stream.b_seekable
|
||||
&& !p_input->stream.p_selected_area->i_size )
|
||||
{
|
||||
msg_Err( p_input, "file %s is empty, aborting", psz_name );
|
||||
free( p_access_data );
|
||||
return VLC_EGENERIC;
|
||||
}
|
||||
|
||||
/* Update default_pts to a suitable value for file access */
|
||||
p_input->i_pts_delay = config_GetInt( p_input, "file-caching" ) * 1000;
|
||||
|
||||
@ -256,14 +265,19 @@ static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer, size_t i_len )
|
||||
#else
|
||||
i_ret = read( p_access_data->i_handle, p_buffer, i_len );
|
||||
#endif
|
||||
|
||||
|
||||
if( i_ret < 0 )
|
||||
{
|
||||
# ifdef HAVE_ERRNO_H
|
||||
msg_Err( p_input, "read failed (%s)", strerror(errno) );
|
||||
if ( errno != EINTR && errno != EAGAIN )
|
||||
msg_Err( p_input, "read failed (%s)", strerror(errno) );
|
||||
# else
|
||||
msg_Err( p_input, "read failed" );
|
||||
# endif
|
||||
|
||||
/* Delay a bit to avoid consuming all the CPU. This is particularly
|
||||
* useful when reading from an unconnected FIFO. */
|
||||
msleep( INPUT_ERROR_SLEEP );
|
||||
}
|
||||
|
||||
return i_ret;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ftp.c:
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001, 2002 VideoLAN
|
||||
* $Id: ftp.c,v 1.4 2002/12/25 02:23:36 massiot Exp $
|
||||
* $Id: ftp.c,v 1.5 2002/12/31 01:54:35 massiot Exp $
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
@ -371,6 +371,7 @@ static int Open( vlc_object_t *p_this )
|
||||
p_input->stream.b_pace_control = 1;
|
||||
p_input->stream.p_selected_area->i_tell = 0;
|
||||
p_input->stream.b_seekable = 1;
|
||||
p_input->stream.b_connected = 1;
|
||||
p_input->stream.p_selected_area->i_size = p_access->i_filesize;
|
||||
p_input->stream.i_method = INPUT_METHOD_NETWORK;
|
||||
vlc_mutex_unlock( &p_input->stream.stream_lock );
|
||||
|
@ -2,7 +2,7 @@
|
||||
* http.c: HTTP access plug-in
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001, 2002 VideoLAN
|
||||
* $Id: http.c,v 1.19 2002/12/23 15:39:07 massiot Exp $
|
||||
* $Id: http.c,v 1.20 2002/12/31 01:54:35 massiot Exp $
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
*
|
||||
@ -608,6 +608,7 @@ static int Open( vlc_object_t *p_this )
|
||||
vlc_mutex_lock( &p_input->stream.stream_lock );
|
||||
p_input->stream.b_pace_control = VLC_TRUE;
|
||||
p_input->stream.b_seekable = VLC_TRUE;
|
||||
p_input->stream.b_connected = VLC_TRUE;
|
||||
p_input->stream.p_selected_area->i_tell = 0;
|
||||
p_input->stream.p_selected_area->i_size = 0;
|
||||
p_input->stream.i_method = INPUT_METHOD_NETWORK;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* mms.c: MMS access plug-in
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001, 2002 VideoLAN
|
||||
* $Id: mms.c,v 1.15 2002/12/30 08:56:19 massiot Exp $
|
||||
* $Id: mms.c,v 1.16 2002/12/31 01:54:35 massiot Exp $
|
||||
*
|
||||
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
|
||||
*
|
||||
@ -250,13 +250,14 @@ static int Open( vlc_object_t *p_this )
|
||||
|
||||
/* *** finished to set some variable *** */
|
||||
vlc_mutex_lock( &p_input->stream.stream_lock );
|
||||
p_input->stream.b_pace_control = 0;
|
||||
if( p_access->i_proto == MMS_PROTO_UDP )
|
||||
{
|
||||
p_input->stream.b_pace_control = 0;
|
||||
p_input->stream.b_connected = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_input->stream.b_pace_control = 1;
|
||||
p_input->stream.b_connected = 1;
|
||||
}
|
||||
p_input->stream.p_selected_area->i_tell = 0;
|
||||
if( p_access->i_packet_count <= 0 )
|
||||
|
@ -287,6 +287,7 @@ int E_(Open) ( vlc_object_t *p_this )
|
||||
|
||||
p_input->stream.b_pace_control = 1;
|
||||
p_input->stream.b_seekable = 0;
|
||||
p_input->stream.b_connected = 0;
|
||||
p_input->stream.p_selected_area->i_tell = 0;
|
||||
|
||||
vlc_mutex_unlock( &p_input->stream.stream_lock );
|
||||
|
@ -2,7 +2,7 @@
|
||||
* udp.c: raw UDP & RTP access plug-in
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001, 2002 VideoLAN
|
||||
* $Id: udp.c,v 1.9 2002/12/30 11:49:32 massiot Exp $
|
||||
* $Id: udp.c,v 1.10 2002/12/31 01:54:35 massiot Exp $
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
* Tristan Leteurtre <tooney@via.ecp.fr>
|
||||
@ -233,6 +233,7 @@ static int Open( vlc_object_t *p_this )
|
||||
vlc_mutex_lock( &p_input->stream.stream_lock );
|
||||
p_input->stream.b_pace_control = 0;
|
||||
p_input->stream.b_seekable = 0;
|
||||
p_input->stream.b_connected = 0;
|
||||
p_input->stream.p_selected_area->i_tell = 0;
|
||||
p_input->stream.i_method = INPUT_METHOD_NETWORK;
|
||||
vlc_mutex_unlock( &p_input->stream.stream_lock );
|
||||
|
@ -2,7 +2,7 @@
|
||||
* v4l.c : Video4Linux input module for vlc
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2002 VideoLAN
|
||||
* $Id: v4l.c,v 1.1 2002/08/08 00:35:10 sam Exp $
|
||||
* $Id: v4l.c,v 1.2 2002/12/31 01:54:36 massiot Exp $
|
||||
*
|
||||
* Author: Samuel Hocevar <sam@zoy.org>
|
||||
*
|
||||
@ -64,6 +64,7 @@ static int V4lOpen( vlc_object_t *p_this )
|
||||
vlc_mutex_lock( &p_input->stream.stream_lock );
|
||||
p_input->stream.b_pace_control = 0;
|
||||
p_input->stream.b_seekable = 0;
|
||||
p_input->stream.b_connected = 0;
|
||||
p_input->stream.p_selected_area->i_size = 0;
|
||||
p_input->stream.p_selected_area->i_tell = 0;
|
||||
p_input->stream.i_method = INPUT_METHOD_FILE;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vcd.c : VCD input module for vlc
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2000 VideoLAN
|
||||
* $Id: vcd.c,v 1.12 2002/12/06 16:34:04 sam Exp $
|
||||
* $Id: vcd.c,v 1.13 2002/12/31 01:54:36 massiot Exp $
|
||||
*
|
||||
* Author: Johan Bilien <jobi@via.ecp.fr>
|
||||
*
|
||||
@ -170,8 +170,8 @@ static int VCDOpen( vlc_object_t *p_this )
|
||||
vlc_mutex_lock( &p_input->stream.stream_lock );
|
||||
|
||||
p_input->stream.b_pace_control = 1;
|
||||
|
||||
p_input->stream.b_seekable = 1;
|
||||
p_input->stream.b_connected = 1;
|
||||
p_input->stream.p_selected_area->i_size = 0;
|
||||
p_input->stream.p_selected_area->i_tell = 0;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vpar_synchro.c : frame dropping routines
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1999-2001 VideoLAN
|
||||
* $Id: synchro.c,v 1.4 2002/11/08 10:26:53 gbazin Exp $
|
||||
* $Id: synchro.c,v 1.5 2002/12/31 01:54:36 massiot Exp $
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
* Samuel Hocevar <sam@via.ecp.fr>
|
||||
@ -386,6 +386,7 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
|
||||
|
||||
if( p_vpar->synchro.i_type == VPAR_SYNCHRO_DEFAULT )
|
||||
{
|
||||
#if 0
|
||||
msg_Dbg( p_vpar->p_fifo, "I("I64Fd") P("I64Fd")[%d] B("I64Fd")"
|
||||
"[%d] YUV("I64Fd") : trashed %d:%d/%d",
|
||||
p_vpar->synchro.p_tau[I_CODING_TYPE],
|
||||
@ -400,6 +401,18 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
|
||||
p_vpar->synchro.i_pic );
|
||||
p_vpar->synchro.i_trashed_pic = p_vpar->synchro.i_not_chosen_pic
|
||||
= p_vpar->synchro.i_pic = 0;
|
||||
#else
|
||||
if ( p_vpar->synchro.i_pic >= 100 )
|
||||
{
|
||||
msg_Dbg( p_vpar->p_fifo, "decoded %d/%d pictures",
|
||||
p_vpar->synchro.i_pic
|
||||
- p_vpar->synchro.i_trashed_pic
|
||||
- p_vpar->synchro.i_not_chosen_pic,
|
||||
p_vpar->synchro.i_pic );
|
||||
p_vpar->synchro.i_trashed_pic = p_vpar->synchro.i_not_chosen_pic
|
||||
= p_vpar->synchro.i_pic = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* decoders.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2002 VideoLAN
|
||||
* $Id: input.c,v 1.220 2002/12/18 14:17:11 sam Exp $
|
||||
* $Id: input.c,v 1.221 2002/12/31 01:54:36 massiot Exp $
|
||||
*
|
||||
* Authors: Christophe Massiot <massiot@via.ecp.fr>
|
||||
*
|
||||
@ -341,7 +341,7 @@ static int RunThread( input_thread_t *p_input )
|
||||
/* Read and demultiplex some data. */
|
||||
i_count = p_input->pf_demux( p_input );
|
||||
|
||||
if( i_count == 0 && p_input->stream.b_seekable )
|
||||
if( i_count == 0 && p_input->stream.b_connected )
|
||||
{
|
||||
/* End of file - we do not set b_die because only the
|
||||
* playlist is allowed to do so. */
|
||||
@ -488,7 +488,7 @@ static int InitThread( input_thread_t * p_input )
|
||||
p_input->p_demux = module_Need( p_input, "demux",
|
||||
p_input->psz_demux );
|
||||
|
||||
if( p_input->p_demux== NULL )
|
||||
if( p_input->p_demux == NULL )
|
||||
{
|
||||
msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
|
||||
p_input->psz_access, p_input->psz_demux, p_input->psz_name );
|
||||
|
@ -2,7 +2,7 @@
|
||||
* darwin_specific.m: Darwin specific features
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2001 VideoLAN
|
||||
* $Id: darwin_specific.m,v 1.1 2002/12/30 08:56:19 massiot Exp $
|
||||
* $Id: darwin_specific.m,v 1.2 2002/12/31 01:54:36 massiot Exp $
|
||||
*
|
||||
* Authors: Samuel Hocevar <sam@zoy.org>
|
||||
* Christophe Massiot <massiot@via.ecp.fr>
|
||||
@ -118,6 +118,7 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
|
||||
/* Check if $LANG is set. */
|
||||
if ( (p_char = getenv("LANG")) == NULL )
|
||||
{
|
||||
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
|
||||
/* Retrieve user's preferences. */
|
||||
NSUserDefaults * p_defs =
|
||||
[[NSUserDefaults standardUserDefaults] autorelease];
|
||||
@ -135,6 +136,8 @@ void system_Init( vlc_t *p_this, int *pi_argc, char *ppsz_argv[] )
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* FIXME : why does it segfault ??? */
|
||||
//[o_pool release];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user