diff options
author | Robin Gareus <robin@gareus.org> | 2015-03-11 00:27:14 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-03-11 00:27:14 +0100 |
commit | c3d76548843f7a69c78305cae9ad0f7bbc7153bc (patch) | |
tree | 2e0fa8a84f7595bdaa5777a0c48c9f20b05834ee /libs/backends/coreaudio/coreaudio_backend.cc | |
parent | fe85575a12d8c81e8d2d08b7d91238a88c8febe7 (diff) |
coreaudio backend: switch threads early
Diffstat (limited to 'libs/backends/coreaudio/coreaudio_backend.cc')
-rw-r--r-- | libs/backends/coreaudio/coreaudio_backend.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libs/backends/coreaudio/coreaudio_backend.cc b/libs/backends/coreaudio/coreaudio_backend.cc index 0e978bff71..4c522dcdd9 100644 --- a/libs/backends/coreaudio/coreaudio_backend.cc +++ b/libs/backends/coreaudio/coreaudio_backend.cc @@ -1558,6 +1558,12 @@ CoreAudioBackend::process_callback (const uint32_t n_samples, const uint64_t hos return 1; } + if (_reinit_thread_callback || _main_thread != pthread_self()) { + _reinit_thread_callback = false; + _main_thread = pthread_self(); + AudioEngine::thread_init_callback (this); + } + if (pthread_mutex_trylock (&_process_callback_mutex)) { // block while devices are added/removed #ifndef NDEBUG @@ -1566,13 +1572,6 @@ CoreAudioBackend::process_callback (const uint32_t n_samples, const uint64_t hos engine.Xrun(); return 1; } - - if (_reinit_thread_callback || _main_thread != pthread_self()) { - _reinit_thread_callback = false; - _main_thread = pthread_self(); - AudioEngine::thread_init_callback (this); - } - /* port-connection change */ pre_process(); |