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
Implement Web Codecs for Skwasm #42184
Conversation
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
final int videoFrameId = surface.acquireObjectId(); | ||
skwasmInstance.skwasmRegisterObject(videoFrameId.toJS, frame as JSAny); | ||
skwasmInstance.skwasmTransferObjectToThread(videoFrameId.toJS, surface.threadId.toJS); | ||
return SkwasmImage(imageCreateFromVideoFrame( |
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.
Is there a potential race between the transfer and SkImage initialization?
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.
No, there isn't, although I could see why you might think so. It is true that the SkImage
is being created synchronously on the UI thread, but it's the image's generator that actually attempts to grab the video frame by its ID and convert it to a texture, and that generator is always run on the web worker right before the image is being either drawn to the actual graphics surface or being rasterized to pixels. Any call that would draw or rasterize the image is sent to the web worker via a postMessage, and the postMessage queue is serial, so those calls are guaranteed to happen after the postMessage that transfers the video frame.
Golden file changes are available for triage from new commit, Click here to view. |
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.
LGTM
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.
…127619) flutter/engine@6ff02c1...99f2653 2023-05-25 jacksongardner@google.com Implement Web Codecs for Skwasm (flutter/engine#42184) 2023-05-25 godofredoc@google.com Move linux clang tidy to engine_v2. (flutter/engine#42112) 2023-05-25 skia-flutter-autoroll@skia.org Roll Skia from 69d0aa065992 to e648bf802cd2 (11 revisions) (flutter/engine#42323) 2023-05-25 jacksongardner@google.com Only use 8 cores for web test compilation. (flutter/engine#42321) 2023-05-25 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from nLnQzTesaABpgroOl... to DNwJQMQZladAsKTjv... (flutter/engine#42322) 2023-05-25 valentin.haloiu@gmail.com Dynamically link against system fontconfig (flutter/engine#40725) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from nLnQzTesaABp to DNwJQMQZladA If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC bdero@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This implements making images from web browser codecs.
This implements a JS support library as well, which allows both the main thread and the background thread to keep a registry of JS objects that can be referenced by a numeric ID and transferred between each other.