Closed 0xpr03 closed 6 years ago
It's kinda sad that I can't find any source about how thread safe libVLC is.. The things I can find are tending towards "non thread safe, but could be at some points", which makes this unusable for multi threaded systems, as you have to put everything behind a mutex.
I cannot judge Send implementation safety because I don't have any knowledge about libVLC thread safety. But Media and other objects may implement Send if they can be called with lock and prohibit pointer cloning over threads.
One temporary solution is providing optional feature to implement Send. Another solution is unsafe wrappers that implement Send for these objects.
According to what I've found and talked people with, send is possible, but not sync. To be honest I've given up on libvlc as it's not even thread safe to read the current volume and wrapping 3 LibVLC objects (player,instance,media) in a Mutex is just not something you want to do in a multi threaded environment. Possibly also leading to deadlocks. I'm going to use the gstreamer lib as it's thread safe by design.
This allows to wrap it inside a RwLock for example, so you can put a player inside a Arc<Mutex<>>