GstVideoDecodrer and stream lock in rust

Hi!

I’m sub classing VideoDecoder in rust. In handle_frame I queue frames to be decoded and an other thread calls finish_frame once decoded. But I encounter deadlocks, seemingly on the stream lock.
Form what I understand, in rust, the stream lock is acquired before handle_frame is called and inside finish_frame. When I block inside of handle_frame because the decode queue is full, it prevent finish_frame from completing, thus blocking the thread that empty the decoded queue => deadlock.

I’ve looked at some decoders in C (like gstv4l2videodec.c) and they use GST_VIDEO_DECODER_STREAM_UNLOCK and GST_VIDEO_DECODER_STREAM_LOCK, but I cant find an equivalent in rust.

What am I missing?

Thanks for your help!!

The bindings currently don’t provide a safe way to temporarily unlock the decoder stream lock. For now you would have to call this via FFI.

Exposing this in a safe way requires a bit of thought but please create an issue at Issues · GStreamer / gstreamer-rs · GitLab