GstQueue "half full" signal?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GstQueue "half full" signal?

turbogrill
Hi,

Is there a clever way to know if a GstQueue is half full? (I can't use
Queue2)

Ideally I would like to have a "halffull" signal similar to how there is a
overrun/underrun signal.
I might be able to play around with the threshold but that would introduce
latency.

My current plan is to call the "current-level-bytes" property from a timer
that runs often.
I haven't got it working yet but it's obviously not the most elegant
solution.

Is there a user callback that can be invoked everytime there is new
data/buffer pushed into the queue? That way I could read the amount of data
there. Maybe on the queue pad?


My application is pretty straight forward, it streams data from a cam to
YouTube. I have a leaky Queue that will signal when the buffer is overrun
and I will then lower the bitrate/resolution. Getting a half full event
would make the rate controller even better.





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GstQueue "half full" signal?

gotsring
You can just add a pad probe to the queue's sink pad that triggers every time
a buffer passes into the queue. Within the callback, you can check
current-level-bytes and current-level-buffers and go from there.

Something like

// Callback function
static GstPadProbeReturn check_queue_levels_cb(GstPad* pad, GstPadProbeInfo
*info, gpointer data)
{
    // Do stuff
    return GST_PAD_PROBE_OK;
}


// Link callback to queue pad
GstPad* queue_sink_pad = gst_element_get_static_pad(queue_element, "sink");
gst_pad_add_probe(queue_sink_pad, GST_PAD_PROBE_TYPE_BUFFER,
check_queue_levels_cb, userdata, NULL);





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel