Skip to content
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

Ability to bundle/find/download binaries built by Cisco #43

Closed
torokati44 opened this issue Jan 2, 2024 · 8 comments
Closed

Ability to bundle/find/download binaries built by Cisco #43

torokati44 opened this issue Jan 2, 2024 · 8 comments
Labels
enhancement New feature or request needs-discussion Something unclear or with conflicting opinions. question Further information is requested

Comments

@torokati44
Copy link

torokati44 commented Jan 2, 2024

Hi!

I'm looking into using this crate for a Rust project (https://ruffle.rs).

However, out of an abundance of caution, I'm not comfortable with either us, or our users, building OpenH264 from source, as the result of that is no longer covered by Cisco's generous licensing.

See http://www.openh264.org/faq.html:

This gives the community the best of all worlds - a team can choose to use the source code, in which case the team is responsible for paying all applicable license fees, or the team can use the binary module distributed by Cisco, in which case Cisco will cover the MPEG LA licensing fees.

Would you consider adding a "safe" option, which doesn't build from source, only acquires/finds/loads the binaries built by Cisco itself?

@ralfbiedert ralfbiedert added enhancement New feature or request question Further information is requested needs-discussion Something unclear or with conflicting opinions. labels Jan 3, 2024
@ralfbiedert
Copy link
Owner

Generally yes, but as always it depends on the details.

You mean something like downloading the library at build time, deploy it to target, then libloading into it, right? This might produce some hiccups [1], but maybe their artifacts could be rehosted some other place.

I probably don't have time to fully implement this myself, but I'd accept PRs for it and assist a bit. In any case, this needs some thought on how to make both the 'source', and the the 'libloading' case nice to maintain.

I'd be up for a discussion / call if someone wants to work on this.

[1] Apparently Cisco's deployment infrastructure isn't the best, which might cause other (security, build) issues:

image

@torokati44
Copy link
Author

torokati44 commented Jan 3, 2024

You mean something like downloading the library at build time, deploy it to target, then libloading into it, right?

Actually, the license requires that the binary is not distributed, but downloaded during/after installation, on the users' machine, directly from Cisco. This is presumably how they can count the number of "deployments" after which they need to pay the license fees to MPEG LA. And this is what Firefox does too, AFAIK.

Apparently Cisco's deployment infrastructure isn't the best, which might cause other (security, build) issues:

Yeah, I'm not happy about this either, but: cisco/openh264#909 (comment)

I probably don't have time to fully implement this myself, but I'd accept PRs for it and assist a bit.

That's completely understandable. In the end, I might go with a fully custom solution, both for the binary acquisition part and the binding generation part, instead of contributing here - sorry about that, it's just easier that way. 😶

I mostly just wanted to bring your attention to the licensing terms, and to the fact that this is a potential blocker for many for using this crate.

@torokati44
Copy link
Author

FWIW the libloading integration built into rust-bindgen (using --dynamic-loading) makes this fairly trivial.

@ralfbiedert
Copy link
Owner

FWIW the libloading integration built into rust-bindgen (using --dynamic-loading) makes this fairly trivial.

Interesting, thanks! Just had a quick look and it appears to produce something. Will give this an hour tomorrow and see where I end up.

@ralfbiedert
Copy link
Owner

ralfbiedert commented Jan 6, 2024

There's a version now on master that you can use like so:

let api = OpenH264API::from_source();
let config = DecoderConfig::default();
let mut decoder = Decoder::with_config(api, config)?;
// ...

or

let api = unsafe { OpenH264API::from_blob(r"/path/to/openh264.dll")? };
let config = DecoderConfig::default();
let mut decoder = Decoder::with_config(api, config)?;
// ...

If you want to use the raw API only (-sys) there's a similar API surface for that.

The whole downloading / SHAnanigans isn't implemented (yet), and there's some discussion needed how that should work. Cisco's FAQ states it should happen during installation, but I haven't read the actual license text if that literally means installation or just some time after installation.

Also should we download / SHA-check in this lib (piles up dependencies, build time, storage paths), or should API-users handle that themselves?

Anyway, feedback welcome.

@ralfbiedert
Copy link
Owner

The library can now be used transparently either from source, or through Cisco's precompiled binary. I've also added some SHA checks to minimize UB accidents.

I didn't add downloading and bunzipping (up for discussion) to keep dependencies somewhat in check.

Closing for now, feel free to file follow-up issues.

@torokati44
Copy link
Author

This is excellent, thank you so much!

Although, as I said, I'll likely end up not relying on this crate; instead, using it as inspiration/reference - which I'll happily acknowledge.
I almost feel bad for "making you do all this for nothing", but actually, IMHO this crate is still better now than it was before, so others may find better use of it.

@ralfbiedert
Copy link
Owner

No worries, and thanks for pointing me to do the --dynamic-loading which I wasn't aware of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-discussion Something unclear or with conflicting opinions. question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants