Commit 5cefc073 authored by Christophe Massiot's avatar Christophe Massiot

* src/misc/threads.c: Implementation of real-time priorities for UNIX-like

  pthread systems (activate with --rt-priority)
* modules/access_output/udp.c: Only discard packets which are _very_ late
parent ccfe579b
......@@ -3,7 +3,7 @@
* This header provides portable declarations for mutexes & conditions
*****************************************************************************
* Copyright (C) 1999, 2002 VideoLAN
* $Id: vlc_threads.h,v 1.34 2003/10/25 00:49:13 sam Exp $
* $Id: vlc_threads.h,v 1.35 2003/11/07 19:30:28 massiot Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -76,6 +76,13 @@
# define VLC_THREAD_PRIORITY_VIDEO (-47)
# define VLC_THREAD_PRIORITY_OUTPUT 37
#elif defined(PTHREAD_COND_T_IN_PTHREAD_H)
# define VLC_THREAD_PRIORITY_LOW 0
# define VLC_THREAD_PRIORITY_INPUT 20
# define VLC_THREAD_PRIORITY_AUDIO 10
# define VLC_THREAD_PRIORITY_VIDEO 0
# define VLC_THREAD_PRIORITY_OUTPUT 30
#elif defined(WIN32) || defined(UNDER_CE)
/* Define different priorities for WinNT/2K/XP and Win9x/Me */
# define VLC_THREAD_PRIORITY_LOW 0
......
......@@ -2,7 +2,7 @@
* udp.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.14 2003/11/01 00:11:31 fenrir Exp $
* $Id: udp.c,v 1.15 2003/11/07 19:30:28 massiot Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -428,7 +428,7 @@ static void ThreadWrite( vlc_object_t *p_this )
i_date_last = i_date;
continue;
}
else if( i_date - i_date_last < 0 )
else if( i_date - i_date_last < -100000 )
{
msg_Dbg( p_thread, "mmh, paquets in the past -> drop" );
......
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.101 2003/11/05 00:39:17 gbazin Exp $
* $Id: libvlc.h,v 1.102 2003/11/07 19:30:28 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -469,6 +469,14 @@ static char *ppsz_language_text[] =
#define DEMUX_LONGTEXT N_( \
"This is a legacy entry to let you configure demux modules")
#define RT_PRIORITY_TEXT N_("Allow VLC to run with a real-time priority")
#define RT_PRIORITY_LONGTEXT N_( \
"Running VLC in real-time priority will allow for much more precise " \
"scheduling and yield better, especially when streaming content. " \
"It can however lock up your whole machine, or make it very very " \
"slow. You should only activate this if you know what you're " \
"doing.")
#define ONEINSTANCE_TEXT N_("Allow only one running instance of VLC")
#define ONEINSTANCE_LONGTEXT N_( \
"Allowing only one running instance of VLC can sometimes be useful, " \
......@@ -747,6 +755,10 @@ vlc_module_begin();
add_module( "access", "access", NULL, NULL, ACCESS_TEXT, ACCESS_LONGTEXT, VLC_TRUE );
add_module( "demux", "demux", NULL, NULL, DEMUX_TEXT, DEMUX_LONGTEXT, VLC_TRUE );
#if !defined(SYS_DARWIN) && defined(PTHREAD_COND_T_IN_PTHREAD_H)
add_bool( "rt-priority", 0, NULL, RT_PRIORITY_TEXT, RT_PRIORITY_LONGTEXT, VLC_TRUE );
#endif
#if defined(WIN32)
add_bool( "one-instance", 0, NULL, ONEINSTANCE_TEXT, ONEINSTANCE_LONGTEXT, VLC_TRUE );
add_bool( "high-priority", 1, NULL, HPRIORITY_TEXT, HPRIORITY_LONGTEXT, VLC_TRUE );
......
/*****************************************************************************
* threads.c : threads implementation for the VideoLAN client
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: threads.c,v 1.42 2003/10/25 00:49:14 sam Exp $
* Copyright (C) 1999, 2000, 2001, 2002, 2003 VideoLAN
* $Id: threads.c,v 1.43 2003/11/07 19:30:28 massiot Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -552,8 +552,11 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_create( &p_this->thread_id, NULL, func, p_data );
#ifdef SYS_DARWIN
if ( i_priority )
if ( i_priority
#ifndef SYS_DARWIN
&& config_GetInt( p_this, "rt-priority" )
#endif
)
{
int i_error, i_policy;
struct sched_param param;
......@@ -576,7 +579,10 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
i_priority = 0;
}
}
#endif
else
{
i_priority = 0;
}
#elif defined( HAVE_CTHREADS_H )
p_this->thread_id = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
......
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