Thanks for the answer ! I’ve seen also that there’s a try_pull_sample()
with a timeout. I believe this is the functionality I need as for the use case I’m targeting to grab frames at a constant rate for robotics applications.
I have the doubt thought, if the user calls try_pull_sample()
let’s say with the minimum timeout (1ns) every 30Hz and misses the sample, what happens internally ? Does gstreamer drop the sample or just puts into a queue until the next pull_sample
call ?
Ideally I want that each time the use call the grab()
method it gets the latest available frame served by the stream and give ownership to the user with zero-copy (if you could comment here).
I tried, bus.set_sync_handler()
and seems to work well. I guess it’s running a job in the background in any case, right ?
For now I got the following solution
pub fn grab(&self) -> Result<Option<Image<u8, 3>>, StreamCaptureError> {
self.appsink
.try_pull_sample(gst::ClockTime::ZERO)
.map(Self::extract_image_frame)
.transpose()
}