-
Notifications
You must be signed in to change notification settings - Fork 127
Main thread isolation in VideoView #659
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
Conversation
it seems like you haven't added any nanpa changeset files to this PR. if this pull request includes changes to code, make sure to add a changeset, by writing a file to
refer to the manpage for more information. |
@@ -285,7 +285,7 @@ public class VideoView: NativeView, Loggable { | |||
|
|||
// Enter .main only if UI updates are required | |||
if trackDidUpdate || shouldRenderDidUpdate || renderModeDidUpdate { | |||
self.mainSyncOrAsync { | |||
self.mainSyncOrAsync { @MainActor in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This MainActor
is necessary only for <5.9 due to lack of assumeIsolate
as you see below 🫳
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't repo the crash with main, how can I repo the crash ?
I used Xcode 16.2 with Package 6.0 - every video track publish will fail 💣 |
@hiroshihorie still unable to pull that one |
I haven't pushed that pod lib yet |
This is a tiny change, but prevents a crash in
.v6
mode by fixing an important inconsistency.OnDidMutate
is called within the critical section - so from any threadSendable
classes, it doesn't make much difference though@MainActor
methods likemainSyncOrAsync
it does, as they:@MainActor
isolatedSo the idea is
mainSyncOrAsync
signature now reflects what really happens here:nonisolated
itself as it's called from a@Sendable
OnDidMutate
💚@MainActor
💚The crash will happen during video track publication, the stack trace is pretty clear: