-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat(libxmf): expose libvpx,add rust examples with it #55
feat(libxmf): expose libvpx,add rust examples with it #55
Conversation
I thought the C and bindings looks good to me I didn't really look at the example, and I can't comment on how normative the rust files are. It's hard to build a mental model of the C/rust interface but I didn't see anything that looked obviously bad or unsafe. Good job! |
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 went through most of it, but I still need some time to review the unsafe code. Since I have a lot of comments for you already, start by addressing them, and I’ll go over it again then.
Co-authored-by: Benoît Cortier <[email protected]>
Co-authored-by: Benoît Cortier <[email protected]>
… github.com:Devolutions/cadeau into ARC-251-devolutions-gateway-video-session-shadowing
rust/cadeau/src/xmf/recorder.rs
Outdated
if !(surface_step * height <= buffer.len()) { | ||
if surface_step * height > buffer.len() { | ||
return Err(RecorderError::BadArgument { name: "buffer" }); | ||
} | ||
if !(width * height * 4 <= buffer.len()) { | ||
if width * height * 4 > buffer.len() { |
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 got reverted again. What’s happening?
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.
Oh, I know why, it is because of clippy!
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.
Indeed! Can you annotate the function with this?
#[expect(clippy::nonminimal_bool)]
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.
looks like expect is an experiment feature, can I use allow instead?
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.
Actually, it was stabilized recently. You can update the Rust toolchain instead 🙂
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 have to update rust-toolchain.toml
Can you also try to run the examples with the LLVM memory sanitizers? You’ll need to build the xmf C library with something like this (at the beginning of the CMakeLists.txt file) target_compile_options(-fsanitize=address)
target_link_options(-fsanitize=address -static-libasan) And Rust nightly + Someone recently wrote a walkthrough blog post about exactly that: https://geo-ant.github.io/blog/2024/rust-address-sanitizer-with-c/ Maybe you can use that as a reference. First, try to introduce a memory issue in the C code and verify that the sanitizer catches it. Then, remove it and try to run the examples, and see if you get any problem. |
I really have problem doing this, I'll try valgrind in wsl instead, |
Here's the Valgrind report
|
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.
Let's merge! We'll need to create a new build of libcadeau before we publish. I want to try the memory sanitizers too, so I'll give a try on my Linux machine.
This pull request exposes libvpx encoder/decoder alone with Images,Frames and Packets to the caller.
Updated rust xmf-sys and wrapped rust cadeau with a safe abstraction.
Added examples to cut the video at a block level precision.
The file timed-dvls.webm is a un-remuxed file copied directly from Gateway recording, which can be used to test the rust
cut
example.