Question regarding trait bounds for some closures in gstreamer-rs
Steven Fontaine
sir.fon1103 at gmail.com
Sat Feb 19 15:16:08 UTC 2022
Hi, I'm in the process of building an app on top of the gstreamer rust
bindings, and I ran into
`gstreamer::prelude::ElementExt::connect_pad_added`. (
https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer/prelude/trait.ElementExt.html#tymethod.connect_pad_added)
I noticed that the closure taken by this function and other similar
functions is Send + Sync. I was curious about the justification behind
marking this as Sync.
To explain my use case, I'm creating a decodebin, and within the decodebin,
creating an appsink. The appsink's callbacks require access to,
essentially, a `std::sync::mpsc::Sender`. (Technically it's a
`gluttin::event_loop::EventLoopProxy, which contains `Sender`, but I doubt
that matters.) `Sender`s are Send, but they're not Sync, so of course I'm
wrapping the whole thing in an Arc + Mutex to make the compiler happy,
which is fine, just a bit unfortunate.
So, I thought I would bring this up and see what the reasons for this are,
or perhaps, if possible, start a discussion about removing the trait if
it's somehow determined that it isn't needed.
Thanks,
Steven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220219/3d9ed5b7/attachment.htm>
More information about the gstreamer-devel
mailing list