From f106b35fa316f7278e4fc556bd6d53e0a3583ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=27=C3=A9lectron=20rare?= <108685187+electron-rare@users.noreply.github.com> Date: Fri, 26 Jun 2026 10:58:28 +0200 Subject: [PATCH] fix(avlivebody): gate Multi-HMR off by default CoreML Multi-HMR inference ran synchronously on the main thread per video frame, saturating the run loop (beachball). Gate it behind AVBODY_MULTIHMR=1; default to skeleton-only rendering from the iPhone 91-joint ARKit stream. --- avlivebody-mac/Sources/AVLiveBody/AVLiveBodyApp.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/avlivebody-mac/Sources/AVLiveBody/AVLiveBodyApp.swift b/avlivebody-mac/Sources/AVLiveBody/AVLiveBodyApp.swift index 379f7b1..ed77a7b 100644 --- a/avlivebody-mac/Sources/AVLiveBody/AVLiveBodyApp.swift +++ b/avlivebody-mac/Sources/AVLiveBody/AVLiveBodyApp.swift @@ -27,7 +27,15 @@ struct AVLiveBodyApp: App { struct ContentView: View { @StateObject private var consumer = USBSkeletonConsumer() private let controller = SceneController() - private let multiHMR: MultiHMRCoreML? = MultiHMRCoreML() + /// Multi-HMR mesh inference (CoreML, ~150-300 ms/frame) is OFF by + /// default: it would saturate the main thread and beachball the UI. + /// Skeleton-only rendering (iPhone 91-joint ARKit stream) otherwise. + /// Enable on a capable, properly-threaded host with AVBODY_MULTIHMR=1. + private let multiHMR: MultiHMRCoreML? = { + guard ProcessInfo.processInfo.environment["AVBODY_MULTIHMR"] == "1" + else { return nil } + return MultiHMRCoreML() + }() /// Placeholder intrinsics until a `.meta` frame supplies real ones. private let cameraK: [Float] = [ 672, 0, 336, 0, 672, 336, 0, 0, 1,