scheduling,xruns

git-svn-id: svn://code.dyne.org/veejay/trunk@770 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2007-02-08 19:43:51 +00:00
parent 33d3e4510a
commit d6743bdd5f
4 changed files with 44 additions and 4 deletions

View File

@@ -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);

View File

@@ -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])

View File

@@ -28,6 +28,8 @@
#include <libvjmem/vjmem.h>
#include <libvjmsg/vj-common.h>
#include <gveejay-reloaded/vj-api.h>
#include <sched.h>
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);

View File

@@ -100,7 +100,10 @@
#include <veejay/gl.h>
#endif
#include <sched.h>
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;