Commit fe95288a authored by Christophe Massiot's avatar Christophe Massiot

Mac OS X-specific :

* We now use real-time threads ;
* Worked around a bug when seeking ;
All :
* Removed my patch to the video output since it causes problems for some
  people.
parent dec3c9e9
......@@ -3,7 +3,7 @@
* This header provides a portable threads implementation.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: threads_funcs.h,v 1.3 2002/05/18 17:47:46 sam Exp $
* $Id: threads_funcs.h,v 1.4 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -751,6 +751,17 @@ static inline int _vlc_thread_create( char * psz_file, int i_line,
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
i_ret = pthread_create( p_thread, NULL, func, p_data );
#ifdef SYS_DARWIN
{
struct sched_param param;
param.sched_priority = 10;
if (pthread_setschedparam(*p_thread, SCHED_RR, &param))
{
intf_ErrMsg("pthread_setschedparam failed");
}
}
#endif
#elif defined( HAVE_CTHREADS_H )
*p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
i_ret = 0;
......
......@@ -2,7 +2,7 @@
* aout_macosx.c : CoreAudio output plugin
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aout_macosx.m,v 1.2 2002/05/19 00:34:54 massiot Exp $
* $Id: aout_macosx.m,v 1.3 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -106,12 +106,6 @@ static int aout_Open( aout_thread_t *p_aout )
OSStatus err;
UInt32 ui_param_size;
struct thread_time_constraint_policy ttcpolicy;
int mib[2];
unsigned int miblen;
int i_busspeed;
size_t len;
/* allocate instance */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL )
......@@ -182,40 +176,6 @@ static int aout_Open( aout_thread_t *p_aout )
return( -1 );
}
/* Go to time-constrained thread policy */
/* Get bus speed */
mib[0] = CTL_HW;
mib[1] = HW_BUS_FREQ;
miblen = 2;
len = 4;
if( sysctl(mib, miblen, &i_busspeed, &len, NULL, 0) == -1 )
{
intf_ErrMsg("vout error: couldn't go to time-constrained policy (bus speed)");
}
else
{
/* This is in AbsoluteTime units, which are equal to
* 1/4 the bus speed on most machines. */
/* FIXME : these are random numbers ! */
/* hard-coded numbers are approximations for 100 MHz bus speed.
* assume that app deals in frame-sized chunks, e.g. 30 per second.
* ttcpolicy.period = 833333; */
ttcpolicy.period = i_busspeed / 120;
/* ttcpolicy.computation = 60000; */
ttcpolicy.computation = i_busspeed / 1440;
/* ttcpolicy.constraint = 120000; */
ttcpolicy.constraint = i_busspeed / 720;
ttcpolicy.preemptible = 1;
if (thread_policy_set(mach_thread_self(),
THREAD_TIME_CONSTRAINT_POLICY, (int *)&ttcpolicy,
THREAD_TIME_CONSTRAINT_POLICY_COUNT) != KERN_SUCCESS)
{
intf_ErrMsg("vout error: couldn't go to time-constrained policy (thread_policy_set)");
}
}
return( 0 );
}
......
......@@ -2,7 +2,7 @@
* intf_controller.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_controller.m,v 1.2 2002/05/18 13:33:44 massiot Exp $
* $Id: intf_controller.m,v 1.3 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -191,7 +191,7 @@
switch( [[NSApp currentEvent] type] )
{
case NSLeftMouseDown:
[o_slider_lock lock];
[o_slider_lock tryLock];
break;
case NSLeftMouseUp:
......
......@@ -2,7 +2,7 @@
* intf_vlc_wrapper.c: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.m,v 1.5 2002/05/19 19:16:40 jlj Exp $
* $Id: intf_vlc_wrapper.m,v 1.6 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -316,28 +316,20 @@ static Intf_VLCWrapper *o_intf = nil;
{
float f_time = 0.0;
vlc_mutex_lock( &p_input_bank->lock );
if( p_input_bank->pp_input[0] != NULL )
{
f_time = (float)p_area->i_tell / (float)p_area->i_size;
}
vlc_mutex_unlock( &p_input_bank->lock );
return( f_time );
}
- (void)setTimeAsFloat:(float)f_position
{
vlc_mutex_lock( &p_input_bank->lock );
if( p_input_bank->pp_input[0] != NULL )
{
input_Seek( p_input_bank->pp_input[0], p_area->i_size * f_position );
}
vlc_mutex_unlock( &p_input_bank->lock );
}
#undef p_area
......
......@@ -184,12 +184,6 @@ static int vout_Init( vout_thread_t *p_vout )
int i_index;
picture_t *p_pic;
struct thread_time_constraint_policy ttcpolicy;
int mib[2];
unsigned int miblen;
int i_busspeed;
size_t len;
I_OUTPUTPICTURES = 0;
/* Initialize the output structure; we already found a codec,
......@@ -237,40 +231,6 @@ static int vout_Init( vout_thread_t *p_vout )
I_OUTPUTPICTURES++;
}
/* Go to time-constrained thread policy */
/* Get bus speed */
mib[0] = CTL_HW;
mib[1] = HW_BUS_FREQ;
miblen = 2;
len = 4;
if( sysctl(mib, miblen, &i_busspeed, &len, NULL, 0) == -1 )
{
intf_ErrMsg("vout error: couldn't go to time-constrained policy (bus speed)");
}
else
{
/* This is in AbsoluteTime units, which are equal to
* 1/4 the bus speed on most machines. */
/* hard-coded numbers are approximations for 100 MHz bus speed.
* assume that app deals in frame-sized chunks, e.g. 30 per second.
* ttcpolicy.period = 833333; */
ttcpolicy.period = i_busspeed / 120;
/* ttcpolicy.computation = 60000; */
ttcpolicy.computation = i_busspeed / 1440;
/* ttcpolicy.constraint = 120000; */
ttcpolicy.constraint = i_busspeed / 720;
ttcpolicy.preemptible = 1;
if (thread_policy_set(mach_thread_self(),
THREAD_TIME_CONSTRAINT_POLICY, (int *)&ttcpolicy,
THREAD_TIME_CONSTRAINT_POLICY_COUNT) != KERN_SUCCESS)
{
intf_ErrMsg("vout error: couldn't go to time-constrained policy (thread_policy_set)");
}
}
return( 0 );
}
......
......@@ -2,7 +2,7 @@
* darwin_specific.c: Darwin specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: darwin_specific.c,v 1.8 2002/04/26 00:20:00 jlj Exp $
* $Id: darwin_specific.c,v 1.9 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -54,7 +54,15 @@ void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
p_char++;
}
return;
/* Run the interface with a real-time priority too */
{
struct sched_param param;
param.sched_priority = 10;
if (pthread_setschedparam(pthread_self(), SCHED_RR, &param))
{
intf_ErrMsg("pthread_setschedparam failed");
}
}
}
/*****************************************************************************
......
......@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread.
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.176 2002/05/17 14:17:05 lool Exp $
* $Id: video_output.c,v 1.177 2002/05/19 23:51:37 massiot Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -577,6 +577,8 @@ static void RunThread( vout_thread_t *p_vout)
continue;
}
#if 0
/* Removed because it causes problems for some people --Meuuh */
else if( display_date > current_date + VOUT_BOGUS_DELAY )
{
/* Picture is waaay too early: it will be destroyed */
......@@ -599,6 +601,7 @@ static void RunThread( vout_thread_t *p_vout)
continue;
}
#endif
else if( display_date > current_date + VOUT_DISPLAY_DELAY )
{
/* A picture is ready to be rendered, but its rendering 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