* 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>
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 )
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 );
}