From d6743bdd5fadb81317c88fa895746eeb15e5c86a Mon Sep 17 00:00:00 2001 From: Niels Elburg Date: Thu, 8 Feb 2007 19:43:51 +0000 Subject: [PATCH] scheduling,xruns git-svn-id: svn://code.dyne.org/veejay/trunk@770 eb8d1916-c9e9-0310-b8de-cf0c9472ead5 --- veejay-current/bio2jack/bio2jack.c | 7 ++++-- veejay-current/configure.ac | 4 ++-- veejay-current/gveejay-reloaded/gveejay.c | 9 ++++++++ veejay-current/veejay/liblavplayvj.c | 28 +++++++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) diff --git a/veejay-current/bio2jack/bio2jack.c b/veejay-current/bio2jack/bio2jack.c index 8a394568..a0bb917c 100644 --- a/veejay-current/bio2jack/bio2jack.c +++ b/veejay-current/bio2jack/bio2jack.c @@ -164,8 +164,11 @@ static int first_free_device = 0; static jack_driver_t outDev[MAX_OUTDEVICES]; /* default audio buffer size */ -#define SECONDS .25 -static long MAX_BUFFERED_BYTES = (16 * 2 * (44100/(1/SECONDS))) / 8; /* 16 bits, 2 channels .25 seconds */ +//#define SECONDS .25 +#define SECONDS .5 +//static long MAX_BUFFERED_BYTES = (16 * 2 * (44100/(1/SECONDS))) / 8; /* 16 bits, 2 channels .25 seconds */ +static long MAX_BUFFERED_BYTES = (16 * 2 * (44100/(1/SECONDS))) / 4; /* 16 bits, 2 channels .25 seconds */ + #if JACK_CLOSE_HACK static void JACK_CloseDevice(jack_driver_t* this, bool close_client); diff --git a/veejay-current/configure.ac b/veejay-current/configure.ac index a7bbd1f5..85f27524 100644 --- a/veejay-current/configure.ac +++ b/veejay-current/configure.ac @@ -1,12 +1,12 @@ dnl Process this file with autoconf to produce a configure script. dnl AC_INIT -AC_INIT([veejay],[0.9.20],[veejay-users@lists.sourceforge.net]) +AC_INIT([veejay],[0.9.21],[veejay-users@lists.sourceforge.net]) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([veejay/veejay.c]) VEEJAY_MAJOR_VERSION=0 VEEJAY_MINOR_VERSION=9 -VEEJAY_MICRO_VERSION=20 +VEEJAY_MICRO_VERSION=21 VEEJAY_VERSION=$VEEJAY_MAJOR_VERSION.$VEEJAY_MINOR_VERSION.$VEEJAY_MICRO_VERSION VEEJAY_CODENAME="Veejay Classic - build $VEEJAY_MINOR_VERSION $VEEJAY_MICRO_VERSION" AC_CONFIG_HEADERS([config.h]) diff --git a/veejay-current/gveejay-reloaded/gveejay.c b/veejay-current/gveejay-reloaded/gveejay.c index 4590943a..bea7267d 100644 --- a/veejay-current/gveejay-reloaded/gveejay.c +++ b/veejay-current/gveejay-reloaded/gveejay.c @@ -28,6 +28,8 @@ #include #include #include +#include + static int port_num = 3490; static char hostname[255]; @@ -136,6 +138,13 @@ int main(int argc, char *argv[]) { if( err ) usage(argv[0]); +/* struct sched_param schp; + memset( &schp, 0, sizeof( schp )); + schp.sched_priority = sched_get_priority_min(SCHED_RR ); + if( sched_setscheduler( 0, SCHED_FIFO, &schp ) != 0 ) + veejay_msg(0, "Error setting RR"); +*/ + if( !g_thread_supported() ) { g_thread_init(NULL); diff --git a/veejay-current/veejay/liblavplayvj.c b/veejay-current/veejay/liblavplayvj.c index 004f1b2a..523c7dcc 100644 --- a/veejay-current/veejay/liblavplayvj.c +++ b/veejay-current/veejay/liblavplayvj.c @@ -100,7 +100,10 @@ #include #endif +#include + static int veejay_pin_cpu( veejay_t *info, int cpu_num ); +static void veejay_schedule_fifo( veejay_t *info, int pid ); // following struct copied from ../utils/videodev.h @@ -1324,6 +1327,11 @@ static void *veejay_mjpeg_playback_thread(void *arg) pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + + /* schedule FIFO */ + + veejay_schedule_fifo( info, getpid()); + vj_get_relative_time(); vj_osc_set_veejay_t(info); @@ -2162,6 +2170,26 @@ static int sched_ncpus() { return sysconf( _SC_NPROCESSORS_ONLN ); } +static void veejay_schedule_fifo(veejay_t *info, int pid ) +{ + struct sched_param schp; + veejay_memset( &schp, 0, sizeof(schp)); + schp.sched_priority = sched_get_priority_max( SCHED_FIFO ); + + veejay_msg(VEEJAY_MSG_DEBUG, "Min prio = %d, Max prio = %d", + sched_get_priority_min( SCHED_FIFO ), + sched_get_priority_max( SCHED_FIFO )); + + if( sched_setscheduler( pid, SCHED_FIFO, &schp ) != 0 ) + { + veejay_msg(VEEJAY_MSG_WARNING, "Cannot set First-In-First-Out scheduling for process %d",pid); + } + else + { + veejay_msg(VEEJAY_MSG_INFO, "Using First-In-First-Out II scheduling for process %d", pid); + } +} + static int veejay_pin_cpu( veejay_t *info, int cpu_num ) { static unsigned long* mask = NULL;