Coreaudio: set real-time constraint before joining the workgroup
The worker thread needs to have a real-time constraint set, before it cab be joined to the workgroup.
This commit is contained in:
parent
87ee609339
commit
6a513a11fa
@ -830,6 +830,11 @@ void *
|
||||
CoreAudioBackend::coreaudio_process_thread (void *arg)
|
||||
{
|
||||
ThreadData* td = reinterpret_cast<ThreadData*> (arg);
|
||||
|
||||
if (pbd_mach_set_realtime_policy (pthread_self (), period_ns, false)) {
|
||||
PBD::warning << _("AudioEngine: process thread failed to set mach realtime policy.") << endmsg;
|
||||
}
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
|
||||
if (td->_joined_workgroup) {
|
||||
/* have WG */
|
||||
@ -871,7 +876,7 @@ int
|
||||
CoreAudioBackend::create_process_thread (boost::function<void()> func)
|
||||
{
|
||||
pthread_t thread_id;
|
||||
ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC);
|
||||
ThreadData* td = new ThreadData (this, func, PBD_RT_STACKSIZE_PROC, 1e9 * _samples_per_period / _samplerate);
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
|
||||
if (_pcmio->workgroup (td->_workgroup)) {
|
||||
@ -890,10 +895,6 @@ CoreAudioBackend::create_process_thread (boost::function<void()> func)
|
||||
PBD::warning << _("AudioEngine: process thread failed to acquire realtime permissions.") << endmsg;
|
||||
}
|
||||
|
||||
if (pbd_mach_set_realtime_policy (thread_id, 1e9 * _samples_per_period / _samplerate, false)) {
|
||||
PBD::warning << _("AudioEngine: process thread failed to set mach realtime policy.") << endmsg;
|
||||
}
|
||||
|
||||
_threads.push_back (thread_id);
|
||||
return 0;
|
||||
}
|
||||
|
@ -388,6 +388,7 @@ class CoreAudioBackend : public AudioBackend, public PortEngineSharedImpl {
|
||||
CoreAudioBackend* engine;
|
||||
boost::function<void ()> f;
|
||||
size_t stacksize;
|
||||
double period_ns;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
|
||||
bool _joined_workgroup;
|
||||
@ -395,8 +396,8 @@ class CoreAudioBackend : public AudioBackend, public PortEngineSharedImpl {
|
||||
os_workgroup_join_token_s _join_token;
|
||||
#endif
|
||||
|
||||
ThreadData (CoreAudioBackend* e, boost::function<void ()> fp, size_t stacksz)
|
||||
: engine (e) , f (fp) , stacksize (stacksz) {}
|
||||
ThreadData (CoreAudioBackend* e, boost::function<void ()> fp, size_t stacksz, double period)
|
||||
: engine (e) , f (fp) , stacksize (stacksz), period_ns {}
|
||||
};
|
||||
|
||||
/* port engine */
|
||||
|
Loading…
Reference in New Issue
Block a user