Commit 4598fd24 authored by Gildas Bazin's avatar Gildas Bazin

* include/vlc_threads.h:

   + lower a bit the input thread priority on win32 (using THREAD_PRIORITY_ABOVE_NORMAL now).
* modules/access/file.c:
   + s/config_GetInt()/var_Get() for file-caching.
* modules/access_output/udp.c:
   + less verbose debug messages.
   + increase thread priority on win32.
parent cf0968da
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* This header provides portable declarations for mutexes & conditions * This header provides portable declarations for mutexes & conditions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2002 VideoLAN * Copyright (C) 1999, 2002 VideoLAN
* $Id: vlc_threads.h,v 1.36 2003/11/22 00:41:07 titer Exp $ * $Id: vlc_threads.h,v 1.37 2004/03/01 12:50:39 gbazin Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
/* Define different priorities for WinNT/2K/XP and Win9x/Me */ /* Define different priorities for WinNT/2K/XP and Win9x/Me */
# define VLC_THREAD_PRIORITY_LOW 0 # define VLC_THREAD_PRIORITY_LOW 0
# define VLC_THREAD_PRIORITY_INPUT \ # define VLC_THREAD_PRIORITY_INPUT \
(IS_WINNT ? THREAD_PRIORITY_TIME_CRITICAL : 0) (IS_WINNT ? THREAD_PRIORITY_ABOVE_NORMAL : 0)
# define VLC_THREAD_PRIORITY_AUDIO \ # define VLC_THREAD_PRIORITY_AUDIO \
(IS_WINNT ? THREAD_PRIORITY_HIGHEST : 0) (IS_WINNT ? THREAD_PRIORITY_HIGHEST : 0)
# define VLC_THREAD_PRIORITY_VIDEO \ # define VLC_THREAD_PRIORITY_VIDEO \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* file.c: file input (file: access plug-in) * file.c: file input (file: access plug-in)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: file.c,v 1.22 2004/01/25 17:31:22 gbazin Exp $ * $Id: file.c,v 1.23 2004/03/01 12:50:39 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -113,6 +113,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -113,6 +113,7 @@ static int Open( vlc_object_t *p_this )
#endif #endif
_input_socket_t * p_access_data; _input_socket_t * p_access_data;
vlc_bool_t b_stdin, b_kfir = 0; vlc_bool_t b_stdin, b_kfir = 0;
vlc_value_t val;
p_input->i_mtu = 0; p_input->i_mtu = 0;
...@@ -258,7 +259,9 @@ static int Open( vlc_object_t *p_this ) ...@@ -258,7 +259,9 @@ static int Open( vlc_object_t *p_this )
} }
/* Update default_pts to a suitable value for file access */ /* Update default_pts to a suitable value for file access */
p_input->i_pts_delay = config_GetInt( p_input, "file-caching" ) * 1000; var_Create( p_input, "file-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_input, "file-caching", &val );
p_input->i_pts_delay = val.i_int * 1000;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* udp.c * udp.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.20 2004/02/20 17:13:42 massiot Exp $ * $Id: udp.c,v 1.21 2004/03/01 12:50:39 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org> * Eric Petit <titer@videolan.org>
...@@ -222,8 +222,13 @@ static int Open( vlc_object_t *p_this ) ...@@ -222,8 +222,13 @@ static int Open( vlc_object_t *p_this )
p_sys->i_mtu = socket_desc.i_mtu; p_sys->i_mtu = socket_desc.i_mtu;
#ifdef WIN32
if( vlc_thread_create( p_sys->p_thread, "sout write thread", ThreadWrite,
VLC_THREAD_PRIORITY_HIGHEST, VLC_FALSE ) )
#else
if( vlc_thread_create( p_sys->p_thread, "sout write thread", ThreadWrite, if( vlc_thread_create( p_sys->p_thread, "sout write thread", ThreadWrite,
VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) ) VLC_THREAD_PRIORITY_OUTPUT, VLC_FALSE ) )
#endif
{ {
msg_Err( p_access->p_sout, "cannot spawn sout access thread" ); msg_Err( p_access->p_sout, "cannot spawn sout access thread" );
vlc_object_destroy( p_sys->p_thread ); vlc_object_destroy( p_sys->p_thread );
...@@ -410,6 +415,7 @@ static void ThreadWrite( vlc_object_t *p_this ) ...@@ -410,6 +415,7 @@ static void ThreadWrite( vlc_object_t *p_this )
sout_access_thread_t *p_thread = (sout_access_thread_t*)p_this; sout_access_thread_t *p_thread = (sout_access_thread_t*)p_this;
sout_instance_t *p_sout = p_thread->p_sout; sout_instance_t *p_sout = p_thread->p_sout;
mtime_t i_date_last = -1; mtime_t i_date_last = -1;
int i_dropped_packets = 0;
while( ! p_thread->b_die ) while( ! p_thread->b_die )
{ {
...@@ -423,18 +429,22 @@ static void ThreadWrite( vlc_object_t *p_this ) ...@@ -423,18 +429,22 @@ static void ThreadWrite( vlc_object_t *p_this )
{ {
if( i_date - i_date_last > 2000000 ) if( i_date - i_date_last > 2000000 )
{ {
msg_Dbg( p_thread, "mmh, hole > 2s -> drop" ); if( !i_dropped_packets )
msg_Dbg( p_thread, "mmh, hole > 2s -> drop" );
sout_BufferDelete( p_sout, p_pk ); sout_BufferDelete( p_sout, p_pk );
i_date_last = i_date; i_date_last = i_date;
i_dropped_packets++;
continue; continue;
} }
else if( i_date - i_date_last < 0 ) else if( i_date - i_date_last < 0 )
{ {
msg_Dbg( p_thread, "mmh, paquets in the past -> drop" ); if( !i_dropped_packets )
msg_Dbg( p_thread, "mmh, paquets in the past -> drop" );
sout_BufferDelete( p_sout, p_pk ); sout_BufferDelete( p_sout, p_pk );
i_date_last = i_date; i_date_last = i_date;
i_dropped_packets++;
continue; continue;
} }
} }
...@@ -442,22 +452,33 @@ static void ThreadWrite( vlc_object_t *p_this ) ...@@ -442,22 +452,33 @@ static void ThreadWrite( vlc_object_t *p_this )
i_sent = mdate(); i_sent = mdate();
if ( i_sent > i_date + 100000 ) if ( i_sent > i_date + 100000 )
{ {
msg_Dbg( p_thread, "late packet to send (" I64Fd ") -> drop", if( !i_dropped_packets )
i_sent - i_date ); msg_Dbg( p_thread, "late packet to send (" I64Fd ") -> drop",
i_sent - i_date );
sout_BufferDelete( p_sout, p_pk ); sout_BufferDelete( p_sout, p_pk );
i_date_last = i_date; i_date_last = i_date;
i_dropped_packets++;
continue; continue;
} }
mwait( i_date ); mwait( i_date );
send( p_thread->i_handle, p_pk->p_buffer, p_pk->i_size, 0 ); send( p_thread->i_handle, p_pk->p_buffer, p_pk->i_size, 0 );
if( i_dropped_packets )
{
msg_Dbg( p_thread, "dropped %i packets", i_dropped_packets );
i_dropped_packets = 0;
}
#if 0
i_sent = mdate(); i_sent = mdate();
if ( i_sent > i_date + 20000 ) if ( i_sent > i_date + 20000 )
{ {
msg_Dbg( p_thread, "packet has been sent too late (" I64Fd ")", msg_Dbg( p_thread, "packet has been sent too late (" I64Fd ")",
i_sent - i_date ); i_sent - i_date );
} }
#endif
sout_BufferDelete( p_sout, p_pk ); sout_BufferDelete( p_sout, p_pk );
i_date_last = i_date; i_date_last = i_date;
} }
......
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