HRTF: Fix deadlock with restarting motion tracking
Some checks are pending
Check if Cog buildable / Build Universal Cog.app (push) Waiting to run
Some checks are pending
Check if Cog buildable / Build Universal Cog.app (push) Waiting to run
Motion tracking was storing a strong reference to the HRTF DSP node, which was resulting in the DSP not shutting down or restarting properly, leading to playback hanging. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
47f50052be
commit
a0a9f79592
1 changed files with 3 additions and 2 deletions
|
@ -40,7 +40,7 @@ static simd_float4x4 convertMatrix(CMRotationMatrix r) {
|
|||
|
||||
static NSLock *motionManagerLock = nil;
|
||||
API_AVAILABLE(macos(14.0)) static CMHeadphoneMotionManager *motionManager = nil;
|
||||
static DSPHRTFNode *registeredMotionListener = nil;
|
||||
static DSPHRTFNode __weak *registeredMotionListener = nil;
|
||||
#endif
|
||||
|
||||
static void registerMotionListener(DSPHRTFNode *listener) {
|
||||
|
@ -55,7 +55,8 @@ static void registerMotionListener(DSPHRTFNode *listener) {
|
|||
[motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion * _Nullable motion, NSError * _Nullable error) {
|
||||
if(motion) {
|
||||
[motionManagerLock lock];
|
||||
[registeredMotionListener reportMotion:convertMatrix(motion.attitude.rotationMatrix)];
|
||||
if(registeredMotionListener)
|
||||
[registeredMotionListener reportMotion:convertMatrix(motion.attitude.rotationMatrix)];
|
||||
[motionManagerLock unlock];
|
||||
}
|
||||
}];
|
||||
|
|
Loading…
Reference in a new issue