ralfbiedert / openh264-rs

Idiomatic Rust wrappers around OpenH264.
66 stars 32 forks source link

Make Encoder/Decoder Send #23

Closed HyeonuPark closed 1 year ago

HyeonuPark commented 1 year ago

Does it makes sense to impl Send on Encoder and Decoder? The openh264 library have multithread feature so I expect them to not rely on things like thread locals or such, but I haven't dived deep to the source code of it yet.

Also it seems that they can be Sync as well with their current API which doesn't rely on &self much. But it would not be that useful without Send.

ralfbiedert commented 1 year ago

I don't know the internals of OpenH264 well enough to make a definitive statement, but I agree that given their API design I've seen so far the types could be at least Send.

About Sync I'm not entirely sure how the DecoderRawAPI would handle this (all methods so far take &self right now), but type itself is gated behind method taking &mut self.

In any case, if you or someone sends a PR adding Send and Sync I'll merge them. If it later turns out OpenH264 doesn't work that way we can just remove these bounds again.