Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid freezing issues by removing session operations during the app lifecycle. #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nullLuli
Copy link

@nullLuli nullLuli commented Aug 16, 2024

I used FastttCamera in my app and collected some freezing stack traces by Apple’s MetricKit:

0   libsystem_kernel.dylib        	0x00000001b72ad4e0 mach_msg_trap + 8
1   libsystem_kernel.dylib        	0x00000001b72adb24 mach_msg + 76 (mach_msg.c:119)
2   CoreFoundation                	0x0000000180408820 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3   CoreFoundation                	0x000000018040ccac __CFRunLoopRun + 1180 (CFRunLoop.c:3000)
4   CoreFoundation                	0x00000001804206b8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5   AVFCore                       	0x0000000189a5d60c -[AVRunLoopCondition _waitInMode:untilDate:] + 412 (AVRunLoopCondition.m:174)
6   AVFCapture                    	0x000000019f46125c -[AVCaptureSession _stopFigCaptureSession] + 436 (AVCaptureSession.m:2031)
7   AVFCapture                    	0x000000019f444284 -[AVCaptureSession _setRunning:] + 180 (AVCaptureSession.m:2103)

After reviewing Apple's documentation, I noticed that in the camera demo provided by Apple, the session operations (such as session init, start running, stop running) are not triggered during app lifecycle changes, and everything functions normally. So I removed this part of the code from my app, and the freezing issues disappeared. Therefore, I believe that frequent session operations can overburden the camera, leading to freezing problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant