-
Notifications
You must be signed in to change notification settings - Fork 89
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
[BUG] Thread Performance Checker: -[AVCaptureSession startRunning] should be called from background thread causing UI unresponsiveness #1784
Comments
@raosanat can you take a look? |
Hi @ShawnHuangS, Can you share a small sample project with that reproducer? That would help a lot the investigation. |
Hi @lucianopa-msft, Here is my code snippet: let groupCallLocator = GroupCallLocator(groupId: groupId)
let joinCallOptions = JoinCallOptions()
if hasVideo {
getVideoOptionFromLocalVideoStreams { [self] outgoingVideoOptions in
rendererLoacalStream()
joinCallOptions.outgoingVideoOptions = outgoingVideoOptions
}
} func rendererLoacalStream() {
getLocalVideoStream { [self] localStream in
guard let localStream = localStream else { return }
do {
let viewOption = CreateViewOptions(scalingMode: .crop)
localPreviewRenderer = try VideoStreamRenderer(localVideoStream: localStream)
DispatchQueue.main.async { [self] in
do {
let localPreivewView = try localPreviewRenderer!.createView(withOptions: viewOption)
// localRenderView = localPreivewView
} catch{
print("### renderer local preview error: \(error)")
}
}
print("### renderer local preview success")
} catch {
print("### renderer local preview error :\(error)")
}
}
} When I comment out the line Thank you for your response. |
If you pause the debugger when UI frozen down, can you assess in which stack trace the Thread 1 (main) is blocked? |
When I set a breakpoint right after the line When I remove
, so I have to keep it inside Additionally, the freeze I am referring to is temporary. The screen resumes only after the warning |
Ok, thank you for the input, we will look into it and get back when we have more info |
Is it necessary to add In my other apps that use the camera, I get the same warning message if I don't run startRunning on a background thread. |
Hi @lucianopa-msft , I believe I've identified the cause of the freezing issue, which occurs during |
Hey @ShawnHuangS,
Yes, I think that should be possible, although for us we had this under a lower level layer so we have to look into that before making any change.
Ok, let's leave this open still so we can still carry an investigation on this issue. |
Describe the bug
When initiating a video call and enabling the local video, the following error occurs: Thread Performance Checker: -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness. This issue causes my UI to freeze and become unresponsive.
Exception or Stack Trace
To Reproduce
Expected behavior
I expected the video call to start without causing the UI to freeze or become unresponsive.
Setup (please complete the following information):
Additional context
Even when attempting to call startRunning from a background thread, the issue persists.
The text was updated successfully, but these errors were encountered: