-
Notifications
You must be signed in to change notification settings - Fork 246
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
Jsapi v0.2 #2446
Jsapi v0.2 #2446
Conversation
219ab27
to
120c3dd
Compare
50d34f5
to
a027b49
Compare
172fe64
to
ce4c992
Compare
Is 0.1.1 valid if this exists if so that should be landed first imo, if not better close it |
@vibhoothiiaanand: |
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.
It looks already fairly good and an interesting demo. I have only a nit and it is good to go for me.
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 was seeing around locally, seems good overall but have some concerns before we land.
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.
Right now, it does not work in Safari
Logs from console:
[Error] invalid width 0 (expected >= 16, <= 32767): Invalid EncoderConfig
__wbindgen_rethrow (2.chunk.js:1786)
__wbindgen_rethrow (bundle.js:908:95)
wasm-stub
<?>.wasm-function[wasm_bindgen::throw_val::hf03b4efa9e9f245f]
<?>.wasm-function[wasm_bindgen::convert::impls::<impl wasm_bindgen::convert::traits::ReturnWasmAbi for core::result::Result<T,wasm_bindgen::JsValue>>::return_abi::h952487efcbd465ce]
<?>.wasm-function[videoencoder_fromEncoderConfig]
wasm-stub
videoencoder_fromEncoderConfig
VideoEncoder (2.chunk.js:1441:96)
(anonymous function) (2.chunk.js:1873)
commitHookEffectListMount (1.chunk.js:19850)
commitPassiveHookEffects (1.chunk.js:19887)
callCallback (1.chunk.js:432)
dispatchEvent
invokeGuardedCallbackDev (1.chunk.js:481)
invokeGuardedCallback (1.chunk.js:534)
flushPassiveEffectsImpl (1.chunk.js:22951)
unstable_runWithPriority (1.chunk.js:28033)
(anonymous function) (1.chunk.js:22798)
workLoop (1.chunk.js:27977)
flushWork (1.chunk.js:27933)
performWorkUntilDeadline (1.chunk.js:27537)
[Error] The above error occurred in the <App> component:
in App (at main.tsx:16)
in StrictMode (at main.tsx:15)
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
logCapturedError (1.chunk.js:19651)
logError (1.chunk.js:19687)
(anonymous function) (1.chunk.js:20803)
callCallback (1.chunk.js:12773)
commitUpdateQueue (1.chunk.js:12796)
commitLifeCycles (1.chunk.js:19997)
commitLayoutEffects (1.chunk.js:22902)
callCallback (1.chunk.js:432)
dispatchEvent
invokeGuardedCallbackDev (1.chunk.js:481)
invokeGuardedCallback (1.chunk.js:534)
commitRootImpl (1.chunk.js:22644)
commitRootImpl
unstable_runWithPriority (1.chunk.js:28033)
commitRoot (1.chunk.js:22486)
finishSyncRender (1.chunk.js:21903)
performSyncWorkOnRoot (1.chunk.js:21889)
performSyncWorkOnRoot
(anonymous function) (1.chunk.js:11373)
unstable_runWithPriority (1.chunk.js:28033)
flushSyncCallbackQueueImpl (1.chunk.js:11368)
flushSyncCallbackQueue (1.chunk.js:11356)
flushPassiveEffectsImpl (1.chunk.js:22978)
unstable_runWithPriority (1.chunk.js:28033)
(anonymous function) (1.chunk.js:22798)
workLoop (1.chunk.js:27977)
flushWork (1.chunk.js:27933)
performWorkUntilDeadline (1.chunk.js:27537)
[Error] invalid width 0 (expected >= 16, <= 32767): Invalid EncoderConfig
performWorkUntilDeadline (1.chunk.js:27551)
rav1e_js_bg.js:1182 Uncaught Error: recursive use of an object detected which would lead to unsafe aliasing in rust
|
f046a47
to
20983fa
Compare
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.
Now it is way better than old times with performance being ok(but too much memory+ ram usage at any case).
But Safari it is broken still stating same error, needs to be fixed
Seems before allocation of value the function is being called.
Once we start the encoding, then the browser goes brrrr with no control over things till it is done flushing and encoding, so in terms of Users, it is a not so nice UX, not sure how to address them.
Edit:
Now on Safari it works with latest head changes 35c70e6
Also,
Would be nice if it is addressed Edit: |
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.
Suggestion: Disable autoplay in favour of better UX and browser handling since once it is started playing/encoding, we do not have fluid control over the browser.
So need to make sure console is open before starting it.
49c03ae
to
0e4edba
Compare
* access HtmlCanvasElements by id * create new HtmlCanvasElement * access CanvasRenderingContext2d
Changes: * access underlying pixel-data (RGBA) * convert to ARGB * convert to I444
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.
Now the set looks good to me, more or less it is fine,
Tested locally with Chrome, Firefox, Safari,
Safari was a bit more optimal on initial testing.
The downside of 0.2 is, it is bit more memory hungry, we need to fix that by 0.3, and as it is an experimental thing, think it is ok to move forward.
Thank you for your work.
* create rav1e::api::Frame<u8> from web::Canvas * switch to u8 (Encoder, Frame, Packer)
* encoder * `trait Encoder` implements basic encoder functionality * rename `struct Encoder` to `FrameEncoder` * www: Adapt to renaming
0e239d9
to
61e1b9a
Compare
* video.onplay * collect data * create frame from data * video.onended * encode all data Thanks to Alexander Fallenstedt for his blog post! (https://dev.to/fallenstedt/using-rust-and-webassembly-to-process-pixels-from-a-video-feed-4hhg) Co-authored-by: Alexander Fallenstedt <a.fallenstedt@gmail.com>
* derive(Default) for EncoderConfig * Add `tools/rebuild.sh` * CI: also set node/npm version for 'build' * Update README.md * Clean Cargo.toml * remove patch-specification of dependency versions * configure wasm-opt arguments * Bump version to 0.2.0
Goals
Feed custom data into encoder for:
HtmlImageElement
I444
dcv-color-primitives
to support wasm32 target (see Webassembly Support aws/dcv-color-primitives#35)Frame
HtmlVideoElement
File upload