Using appsink with GLib asynchronous API
hyperlight
minh at keirton.com
Mon Oct 26 20:21:39 UTC 2020
In my application, I have the following pipeline (simplified to exclude
filter-like elements):
queue -> appsink (start asynchronous
tasks)
/
v4l2src -> [...] -> tee1
\ queue -> [...]
-> videosink
\ /
queue -> tee2
\
queue -> [...]
-> filesink
Use case: when a buffer arrive at appsink with metadata attached by some
upstream element, the appsink read the metadata and if a condition is met,
turn A on, after X amount of time, turn A off. I tried to simulate this with
the sleep() function but doing that lead to many loss frame from the source
and affect the result of other sinks in the pipeline:
v4l2src gstv4l2src.c:976:gst_v4l2src_create:<camera-source> lost frames
detected: count = 28 - ts: 0:00:12.084989155
I think the reason why the issue happens is because the appsink couldn’t
keep up the the source element due to the delay introduced (i.e., wait for X
amount of time before turn A off), which is why we see v4l2src reports lost
frames and prevent those lost frames to be received by other sinks
(videosink and filesink). Is that correct?
TO achieve this task from appsink: "using arrived buffer metadata, if a
condition is met, turn A on, after X amount of time turn A off", I think I
will need to use some sort of asynchronous programming. I look into GLib
Asynchronous Programming
<https://developer.gnome.org/programming-guidelines/stable/async-programming.html.en>
and it seems like what I need since gstreamer is built on top of GLib but
I'm not sure how to do so in gstreamer without blocking the flow of the
pipeline.
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list