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)
|
CoreAudioBackend::coreaudio_process_thread (void *arg)
|
||||||
{
|
{
|
||||||
ThreadData* td = reinterpret_cast<ThreadData*> (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 MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
|
||||||
if (td->_joined_workgroup) {
|
if (td->_joined_workgroup) {
|
||||||
/* have WG */
|
/* have WG */
|
||||||
|
@ -871,7 +876,7 @@ int
|
||||||
CoreAudioBackend::create_process_thread (boost::function<void()> func)
|
CoreAudioBackend::create_process_thread (boost::function<void()> func)
|
||||||
{
|
{
|
||||||
pthread_t thread_id;
|
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 MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
|
||||||
if (_pcmio->workgroup (td->_workgroup)) {
|
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;
|
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);
|
_threads.push_back (thread_id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,6 +388,7 @@ class CoreAudioBackend : public AudioBackend, public PortEngineSharedImpl {
|
||||||
CoreAudioBackend* engine;
|
CoreAudioBackend* engine;
|
||||||
boost::function<void ()> f;
|
boost::function<void ()> f;
|
||||||
size_t stacksize;
|
size_t stacksize;
|
||||||
|
double period_ns;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
|
||||||
bool _joined_workgroup;
|
bool _joined_workgroup;
|
||||||
|
@ -395,8 +396,8 @@ class CoreAudioBackend : public AudioBackend, public PortEngineSharedImpl {
|
||||||
os_workgroup_join_token_s _join_token;
|
os_workgroup_join_token_s _join_token;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ThreadData (CoreAudioBackend* e, boost::function<void ()> fp, size_t stacksz)
|
ThreadData (CoreAudioBackend* e, boost::function<void ()> fp, size_t stacksz, double period)
|
||||||
: engine (e) , f (fp) , stacksize (stacksz) {}
|
: engine (e) , f (fp) , stacksize (stacksz), period_ns {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* port engine */
|
/* port engine */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user