Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: terminator356 <terminator356@us...> - 2009-12-20 05:00:52
|
Update of /cvsroot/lmuse/muse/muse/driver In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9740/muse/driver Modified Files: Tag: REL07 audiodev.h dummyaudio.cpp jack.cpp jackaudio.h Log Message: See ChangeLog Index: jackaudio.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/driver/jackaudio.h,v retrieving revision 1.20.2.3 retrieving revision 1.20.2.4 diff -C2 -d -r1.20.2.3 -r1.20.2.4 *** jackaudio.h 20 Jun 2009 22:20:41 -0000 1.20.2.3 --- jackaudio.h 20 Dec 2009 05:00:35 -0000 1.20.2.4 *************** *** 30,35 **** virtual ~JackAudioDevice(); virtual void nullify_client() { _client = 0; } ! virtual void start(); virtual void stop (); virtual int framePos() const; --- 30,38 ---- virtual ~JackAudioDevice(); virtual void nullify_client() { _client = 0; } ! ! //virtual void start(); ! virtual void start(int); virtual void stop (); + virtual int framePos() const; *************** *** 57,60 **** --- 60,64 ---- virtual unsigned int getCurFrame() { return pos.frame; } virtual bool isRealtime() { return jack_is_realtime(_client); } + virtual int realtimePriority() const; virtual void startTransport(); virtual void stopTransport(); Index: jack.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/driver/jack.cpp,v retrieving revision 1.30.2.16 retrieving revision 1.30.2.17 diff -C2 -d -r1.30.2.16 -r1.30.2.17 *** jack.cpp 4 Dec 2009 02:21:49 -0000 1.30.2.16 --- jack.cpp 20 Dec 2009 05:00:35 -0000 1.30.2.17 *************** *** 263,266 **** --- 263,291 ---- //--------------------------------------------------------- + // realtimePriority + // return zero if not running realtime + // can only be called if JACK client thread is already + // running + //--------------------------------------------------------- + + int JackAudioDevice::realtimePriority() const + { + pthread_t t = jack_client_thread_id(_client); + int policy; + struct sched_param param; + memset(¶m, 0, sizeof(param)); + int rv = pthread_getschedparam(t, &policy, ¶m); + if (rv) { + perror("MusE: JackAudioDevice::realtimePriority: Error: Get jack schedule parameter"); + return 0; + } + if (policy != SCHED_FIFO) { + printf("MusE: JackAudioDevice::realtimePriority: JACK is not running realtime\n"); + return 0; + } + return param.sched_priority; + } + + //--------------------------------------------------------- // getJackName() //--------------------------------------------------------- *************** *** 665,669 **** //--------------------------------------------------------- ! void JackAudioDevice::start() { if (JACK_DEBUG) --- 690,695 ---- //--------------------------------------------------------- ! //void JackAudioDevice::start() ! void JackAudioDevice::start(int /*priority*/) { if (JACK_DEBUG) Index: dummyaudio.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/driver/dummyaudio.cpp,v retrieving revision 1.3.2.15 retrieving revision 1.3.2.16 diff -C2 -d -r1.3.2.15 -r1.3.2.16 *** dummyaudio.cpp 6 Dec 2009 01:25:21 -0000 1.3.2.15 --- dummyaudio.cpp 20 Dec 2009 05:00:35 -0000 1.3.2.16 *************** *** 45,48 **** --- 45,49 ---- //float buffer[1024]; float* buffer; + int realTimePriority; public: *************** *** 60,64 **** } ! virtual void start(); virtual void stop (); virtual int framePos() const { --- 61,67 ---- } ! //virtual void start(); ! virtual void start(int); ! virtual void stop (); virtual int framePos() const { *************** *** 107,110 **** --- 110,114 ---- return _framePos; } virtual bool isRealtime() { return realtimeFlag; } + virtual int realtimePriority() const { return 40; } virtual void startTransport() { if(DEBUG_DUMMY) *************** *** 246,249 **** --- 250,254 ---- myPollFd.events = POLLIN; + /* doSetuid(); struct sched_param rt_param; *************** *** 258,262 **** memset(&rt_param, 0, sizeof(sched_param)); ! rt_param.sched_priority = 1; rv = pthread_setschedparam(pthread_self(), SCHED_FIFO, &rt_param); if (rv != 0) --- 263,268 ---- memset(&rt_param, 0, sizeof(sched_param)); ! //rt_param.sched_priority = 1; ! rt_param.sched_priority = realtimePriority(); rv = pthread_setschedparam(pthread_self(), SCHED_FIFO, &rt_param); if (rv != 0) *************** *** 275,278 **** --- 281,315 ---- } undoSetuid(); + */ + + #ifndef __APPLE__ + doSetuid(); + if (realTimePriority) { + // + // check if we really got realtime priviledges + // + int policy; + if ((policy = sched_getscheduler (0)) < 0) { + printf("cannot get current client scheduler for audio dummy thread: %s!\n", strerror(errno)); + } + else + { + if (policy != SCHED_FIFO) + printf("audio dummy thread _NOT_ running SCHED_FIFO\n"); + else if (debugMsg) { + struct sched_param rt_param; + memset(&rt_param, 0, sizeof(sched_param)); + int type; + int rv = pthread_getschedparam(pthread_self(), &type, &rt_param); + if (rv == -1) + perror("get scheduler parameter"); + printf("audio dummy thread running SCHED_FIFO priority %d\n", + rt_param.sched_priority); + } + } + } + undoSetuid(); + #endif + /* unsigned long tick = 0;*/ // prevent compiler warning: unused variable for (;;) { *************** *** 325,335 **** } ! void DummyAudioDevice::start() { ! pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t)); ! pthread_attr_init(attributes); if (pthread_create(&dummyThread, attributes, ::dummyLoop, this)) perror("creating thread failed:"); ! pthread_attr_destroy(attributes); } --- 362,396 ---- } ! //void DummyAudioDevice::start() ! void DummyAudioDevice::start(int priority) { ! realTimePriority = priority; ! pthread_attr_t* attributes = 0; ! ! if (priority) { ! attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t)); ! pthread_attr_init(attributes); ! ! if (pthread_attr_setschedpolicy(attributes, SCHED_FIFO)) { ! printf("cannot set FIFO scheduling class for RT thread\n"); ! } ! if (pthread_attr_setscope (attributes, PTHREAD_SCOPE_SYSTEM)) { ! printf("Cannot set scheduling scope for RT thread\n"); ! } ! struct sched_param rt_param; ! memset(&rt_param, 0, sizeof(rt_param)); ! rt_param.sched_priority = priority; ! if (pthread_attr_setschedparam (attributes, &rt_param)) { ! printf("Cannot set scheduling priority %d for RT thread (%s)\n", ! priority, strerror(errno)); ! } ! } ! ! //pthread_attr_t* attributes = (pthread_attr_t*) malloc(sizeof(pthread_attr_t)); ! //pthread_attr_init(attributes); if (pthread_create(&dummyThread, attributes, ::dummyLoop, this)) perror("creating thread failed:"); ! if (priority) ! pthread_attr_destroy(attributes); } Index: audiodev.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/driver/audiodev.h,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -C2 -d -r1.5.2.1 -r1.5.2.2 *** audiodev.h 20 Jun 2009 22:20:41 -0000 1.5.2.1 --- audiodev.h 20 Dec 2009 05:00:35 -0000 1.5.2.2 *************** *** 23,27 **** virtual ~AudioDevice() {} ! virtual void start() = 0; virtual void stop () = 0; virtual int framePos() const = 0; --- 23,29 ---- virtual ~AudioDevice() {} ! //virtual void start() = 0; ! virtual void start(int priority) = 0; ! virtual void stop () = 0; virtual int framePos() const = 0; *************** *** 45,48 **** --- 47,51 ---- virtual unsigned getCurFrame() = 0; virtual bool isRealtime() = 0; + virtual int realtimePriority() const = 0; // return zero if not realtime virtual void startTransport() = 0; virtual void stopTransport() = 0; |