[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/kmid
From:       Pedro Lopez-Cabanillas <pedro.lopez.cabanillas () gmail ! com>
Date:       2010-07-11 6:12:35
Message-ID: 20100711061235.C61F7AC85F () svn ! kde ! org
[Download RAW message or body]

SVN commit 1148577 by pedrol:

Fixed bug in Drumstick class SequencerInputThread: realtime priority must be applied \
in run() instead of start() to avoid changing the scheduling policy of the parent. \
This is a problem when running FluidSynth in systems affected by a glib-2.22 bug that \
has not yet been fixed. Reference: https://bugzilla.gnome.org/show_bug.cgi?id=599079  \



 M  +3 -3      alsa/alsabackend.cpp  
 M  +12 -13    drumstick/src/alsaclient.cpp  


--- trunk/extragear/multimedia/kmid/alsa/alsabackend.cpp #1148576:1148577
@@ -69,14 +69,14 @@
     ALSABackend::ALSABackend(QObject* parent, const QVariantList& args)
         : Backend(parent, args), d(new BackendPrivate)
     {
-        struct sched_param p;
+        //struct sched_param p;
         try {
             d->m_object = new ALSAMIDIObject(this);
             d->m_output = new ALSAMIDIOutput(this);
             d->m_object->initialize(d->m_output);
             d->m_initialized = true;
-            ::memset(&p, 0, sizeof(p));
-            ::sched_setscheduler(QCoreApplication::applicationPid(), SCHED_OTHER, \
&p); +            //::memset(&p, 0, sizeof(p));
+            //::sched_setscheduler(QCoreApplication::applicationPid(), SCHED_OTHER, \
&p);  } catch (const SequencerError& ex) {
             QString errorstr = i18nc("@info","Fatal error from the ALSA sequencer \
                backend. "
                 "This usually happens when the kernel does not have ALSA support, "
--- trunk/extragear/multimedia/kmid/drumstick/src/alsaclient.cpp #1148576:1148577
@@ -1701,21 +1701,8 @@
 void
 MidiClient::SequencerInputThread::start( Priority priority )
 {
-    int rc;
-    struct sched_param p;
-
     QThread::start(priority);
-
-    if ( priority == TimeCriticalPriority ) {
-        ::memset(&p, 0, sizeof(p));
-        p.sched_priority = 6;
-        rc = ::pthread_setschedparam(pthread_self(), SCHED_FIFO, &p);
-        if (rc != 0) {
-            qWarning() << "pthread_setschedparam to SCHED_FIFO failed, rc="
-                       << rc << ::strerror(rc);
         }
-    }
-}
 
 /**
  * Main input thread process loop.
@@ -1726,7 +1713,19 @@
     unsigned long npfd;
     pollfd* pfd;
     int rt;
+    struct sched_param p;
+    Priority prio = priority();
 
+    if ( prio == TimeCriticalPriority ) {
+        ::memset(&p, 0, sizeof(p));
+        p.sched_priority = 6;
+        rt = ::pthread_setschedparam(::pthread_self(), SCHED_FIFO, &p);
+        if (rt != 0) {
+            qWarning() << "pthread_setschedparam(SCHED_FIFO) failed, err="
+                       << rt << ::strerror(rt);
+        }
+    }
+
     if (m_MidiClient != NULL) {
         npfd = snd_seq_poll_descriptors_count(m_MidiClient->getHandle(), POLLIN);
         pfd = (pollfd *) alloca(npfd * sizeof(pollfd));


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic