Browse Source

Implement jack_client_real_time_priority and jack_client_max_real_time_priority API.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3232 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.1
sletz 15 years ago
parent
commit
bb7b377860
9 changed files with 47 additions and 10 deletions
  1. +1
    -0
      ChangeLog
  2. +34
    -2
      common/JackAPI.cpp
  3. +1
    -1
      common/JackClient.cpp
  4. +6
    -2
      common/JackEngineControl.h
  5. +1
    -1
      common/JackNetAdapter.cpp
  6. +1
    -1
      common/JackThreadedDriver.cpp
  7. +1
    -1
      common/JackWaitThreadedDriver.cpp
  8. +1
    -1
      linux/firewire/JackFFADODriver.cpp
  9. +1
    -1
      linux/freebob/JackFreebobDriver.cpp

+ 1
- 0
ChangeLog View File

@@ -26,6 +26,7 @@ Michael Voigt
2009-01-05 Stephane Letz <letz@grame.fr>

* Synchronize jack2 public headers with jack1 ones.
* Implement jack_client_real_time_priority and jack_client_max_real_time_priority API.

2008-12-18 Stephane Letz <letz@grame.fr>



+ 34
- 2
common/JackAPI.cpp View File

@@ -209,6 +209,8 @@ extern "C"
EXPORT void jack_set_transport_info (jack_client_t *client,
jack_transport_info_t *tinfo);

EXPORT int jack_client_real_time_priority (jack_client_t*);
EXPORT int jack_client_max_real_time_priority (jack_client_t*);
EXPORT int jack_acquire_real_time_scheduling (pthread_t thread, int priority);
EXPORT int jack_client_create_thread (jack_client_t* client,
pthread_t *thread,
@@ -218,8 +220,8 @@ extern "C"
void *arg);
EXPORT int jack_drop_real_time_scheduling (pthread_t thread);
EXPORT int jack_client_stop_thread(jack_client_t* client, pthread_t thread);
EXPORT int jack_client_kill_thread(jack_client_t* client, pthread_t thread);
EXPORT int jack_client_stop_thread (jack_client_t* client, pthread_t thread);
EXPORT int jack_client_kill_thread (jack_client_t* client, pthread_t thread);

EXPORT char * jack_get_internal_client_name (jack_client_t *client,
jack_intclient_t intclient);
@@ -1717,6 +1719,36 @@ EXPORT void jack_reset_max_delayed_usecs(jack_client_t* ext_client)
}

// thread.h
EXPORT int jack_client_real_time_priority(jack_client_t* ext_client)
{
#ifdef __CLIENTDEBUG__
JackLibGlobals::CheckContext();
#endif
JackClient* client = (JackClient*)ext_client;
if (client == NULL) {
jack_error("jack_client_real_time_priority called with a NULL client");
return -1;
} else {
JackEngineControl* control = GetEngineControl();
return (control->fRealTime) ? control->fClientPriority : -1;
}
}

EXPORT int jack_client_max_real_time_priority(jack_client_t* ext_client)
{
#ifdef __CLIENTDEBUG__
JackLibGlobals::CheckContext();
#endif
JackClient* client = (JackClient*)ext_client;
if (client == NULL) {
jack_error("jack_client_max_real_time_priority called with a NULL client");
return -1;
} else {
JackEngineControl* control = GetEngineControl();
return (control->fRealTime) ? control->fMaxClientPriority : -1;
}
}
EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority)
{
JackEngineControl* control = GetEngineControl();


+ 1
- 1
common/JackClient.cpp View File

@@ -344,7 +344,7 @@ int JackClient::StartThread()
}

if (GetEngineControl()->fRealTime) {
if (fThread.AcquireRealTime(GetEngineControl()->fPriority - 1) < 0) {
if (fThread.AcquireRealTime(GetEngineControl()->fClientPriority) < 0) {
jack_error("AcquireRealTime error");
}
}


+ 6
- 2
common/JackEngineControl.h View File

@@ -53,7 +53,9 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem
float fXrunDelayedUsecs;
bool fTimeOut;
bool fRealTime;
int fPriority;
int fServerPriority;
int fClientPriority;
int fMaxClientPriority;
char fServerName[64];
JackTransportEngine fTransport;
bool fVerbose;
@@ -87,7 +89,9 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem
fTimeOut = (timeout > 0);
fTimeOutUsecs = timeout * 1000;
fRealTime = rt;
fPriority = priority;
fServerPriority = priority;
fClientPriority = (rt) ? priority - 5 : 0;
fMaxClientPriority = (rt) ? priority - 1 : 0;
fVerbose = verbose;
fPrevCycleTime = 0;
fCurCycleTime = 0;


+ 1
- 1
common/JackNetAdapter.cpp View File

@@ -216,7 +216,7 @@ namespace Jack
SetAdaptedBufferSize ( fParams.fPeriodSize );
SetAdaptedSampleRate ( fParams.fSampleRate );
if (fThread.AcquireRealTime ( JackServer::fInstance->GetEngineControl()->fPriority - 1 ) < 0) {
if (fThread.AcquireRealTime ( JackServer::fInstance->GetEngineControl()->fClientPriority ) < 0) {
jack_error("AcquireRealTime error");
} else {
set_threaded_log_function();


+ 1
- 1
common/JackThreadedDriver.cpp View File

@@ -210,7 +210,7 @@ bool JackThreadedDriver::Init()
jack_log("JackThreadedDriver::Init IsRealTime");
// Will do "something" on OSX only...
fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint);
if (fThread.AcquireRealTime(GetEngineControl()->fPriority) < 0) {
if (fThread.AcquireRealTime(GetEngineControl()->fServerPriority) < 0) {
jack_error("AcquireRealTime error");
} else {
set_threaded_log_function();


+ 1
- 1
common/JackWaitThreadedDriver.cpp View File

@@ -47,7 +47,7 @@ bool JackWaitThreadedDriver::Execute()
jack_log("JackWaitThreadedDriver::Init IsRealTime");
// Will do "something" on OSX only...
fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint);
if (fThread.AcquireRealTime(GetEngineControl()->fPriority) < 0) {
if (fThread.AcquireRealTime(GetEngineControl()->fServerPriority) < 0) {
jack_error("AcquireRealTime error");
} else {
set_threaded_log_function();


+ 1
- 1
linux/firewire/JackFFADODriver.cpp View File

@@ -462,7 +462,7 @@ int JackFFADODriver::Attach()
/* packetizer thread options */
driver->device_options.realtime = (fEngineControl->fRealTime ? 1 : 0);

driver->device_options.packetizer_priority = fEngineControl->fPriority +
driver->device_options.packetizer_priority = fEngineControl->fServerPriority +
FFADO_RT_PRIORITY_PACKETIZER_RELATIVE;
if (driver->device_options.packetizer_priority > 98) {
driver->device_options.packetizer_priority = 98;


+ 1
- 1
linux/freebob/JackFreebobDriver.cpp View File

@@ -682,7 +682,7 @@ int JackFreebobDriver::Attach()
/* packetizer thread options */
driver->device_options.realtime = (fEngineControl->fRealTime ? 1 : 0);

driver->device_options.packetizer_priority = fEngineControl->fPriority +
driver->device_options.packetizer_priority = fEngineControl->fServerPriority +
FREEBOB_RT_PRIORITY_PACKETIZER_RELATIVE;
if (driver->device_options.packetizer_priority > 98) {
driver->device_options.packetizer_priority = 98;


Loading…
Cancel
Save