perf: delay depth estimator prewarming to avoid stutter

This commit is contained in:
Hinnka committed 2026-05-10 22:31:34 +08:00
1 parent 8535f8e821
commit 64f4bfe7be
2 files changed
+6 -1

No files matched your search

@@ -245,7 +245,6 @@ class MainActivity : ComponentActivity() {
StartupTrace.mark("MainActivity.decorView.post")
reportFullyDrawn()
StartupTrace.reportFullyDrawn("MainActivity.reportFullyDrawn")
cameraViewModel.prewarmDepthEstimator()
}
}
@@ -3262,6 +3262,12 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
fun onShutterAnimationTriggered() {
_canStartShutterAnimation.value = true
viewModelScope.launch {
// Delay prewarming to avoid stuttering during the initial reveal animation
// 150ms initial delay + 800ms animation + 250ms buffer
delay(1200)
prewarmDepthEstimator()
}
}
override fun onCleared() {