Pipeline latency

José Rafael zerafael at gmail.com
Thu Mar 15 17:07:05 UTC 2018


Hi!

Thank you. I tried with the code below:

static void check_latency (GstElement *element){

        GstQuery * query;
        gboolean live;
        GstClockTime min_latency, max_latency;

        g_print ( "DELAY: latency query\n" );

        query = gst_query_new_latency();
        if (!gst_element_query(GST_ELEMENT_CAST (element), query)){
                g_print ( "DELAY: error getting latency\n" );
        } else {
                gst_query_parse_latency (query, &live, &min_latency,
&max_latency);
                gst_query_unref(query);
                g_print ( "DELAY: min_latency %lu %" GST_TIME_FORMAT
"ms\n",min_latency, GST_TIME_ARGS(min_latency) );
        }

}

I am calling it from this tick_latency call using the sink element as
parameter:

static gboolean tick_latency (gpointer data)
{
        check_latency(sink);
        return TRUE;
}

g_timeout_add (100, tick_latency, NULL);

However, the result is always zero. Do you see a problem? A reason to be
zero?
In the log (below) this zero latency is returned through the pipeline.

Thanks for the help, don't know other way to collect this delay value.

[]s
Rafael

DELAY: latency query
0:00:23.013069583 25082      0x1710600 DEBUG                  query
gstquery.c:674:gst_query_new_custom: creating new query 0x190acf0 latency
0:00:23.013155881 25082      0x1710600 DEBUG               basesink
gstbasesink.c:1120:gst_base_sink_query_latency:<enc_tx_sink> we are ready
for LATENCY query
0:00:23.013261063 25082      0x1710600 DEBUG                  query
gstquery.c:674:gst_query_new_custom: creating new query 0x190aa30 latency
0:00:23.013284896 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:4042:gst_pad_peer_query:<enc_tx_sink:sink> peer query 0x190aa30
(latency)
0:00:23.013402964 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3915:gst_pad_query:<enc_tx_rtppay:src> doing query 0x190aa30
(latency)
0:00:23.013573045 25082      0x1710600 DEBUG                  query
gstquery.c:674:gst_query_new_custom: creating new query 0x190aca0 latency
0:00:23.013616803 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:4042:gst_pad_peer_query:<enc_tx_rtppay:sink> peer query 0x190aca0
(latency)
0:00:23.013671896 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3915:gst_pad_query:<enc_tx_enc:src> doing query 0x190aca0 (latency)
0:00:23.013740225 25082      0x1710600 DEBUG           videoencoder
gstvideoencoder.c:1298:gst_video_encoder_src_query:<enc_tx_enc> received
query 7683, latency
0:00:23.013768880 25082      0x1710600 LOG             videoencoder
gstvideoencoder.c:1233:gst_video_encoder_src_query_default:<enc_tx_enc>
handling query: latency query: 0x190aca0, GstQueryLatency,
live=(boolean)false, min-latency=(guint64)0,
max-latency=(guint64)18446744073709551615;
0:00:23.013812794 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:4042:gst_pad_peer_query:<enc_tx_enc:sink> peer query 0x190aca0
(latency)
0:00:23.013868931 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3915:gst_pad_query:<enc_tx_videoparse:src> doing query 0x190aca0
(latency)
0:00:23.013923871 25082      0x1710600 DEBUG               rawparse
gstrawparse.c:957:gst_raw_parse_src_query: src_query latency
0:00:23.014137909 25082      0x1710600 DEBUG                  query
gstquery.c:674:gst_query_new_custom: creating new query 0x190a850 latency
0:00:23.014193904 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:4042:gst_pad_peer_query:<enc_tx_videoparse:sink> peer query
0x190a850 (latency)
0:00:23.014248918 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3915:gst_pad_query:<enc_tx_src:src> doing query 0x190a850 (latency)
0:00:23.014306937 25082      0x1710600 LOG                  basesrc
gstbasesrc.c:733:gst_base_src_query_latency:<enc_tx_src> latency: live 0,
min 0:00:00.000000000, max 0:00:00.000000000
0:00:23.014329539 25082      0x1710600 LOG                  basesrc
gstbasesrc.c:1188:gst_base_src_default_query:<enc_tx_src> report latency:
live 0, min 0:00:00.000000000, max 0:00:00.000000000
0:00:23.014358112 25082      0x1710600 DEBUG                basesrc
gstbasesrc.c:1296:gst_base_src_default_query:<enc_tx_src> query latency
returns 1
0:00:23.014426751 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3938:gst_pad_query:<enc_tx_src:src> sent query 0x190a850
(latency), result 1
0:00:23.014483790 25082      0x1710600 LOG                 GST_PADS
gstpad.c:3216:query_latency_default_fold:<enc_tx_videoparse:sink> got
latency live:false min:0 max:0
0:00:23.014596087 25082      0x1710600 LOG                 GST_PADS
gstpad.c:3287:gst_pad_query_latency_default:<enc_tx_videoparse:src> got
latency live:false min:0 max:-1
0:00:23.014624050 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3372:gst_pad_query_default:<enc_tx_videoparse:src> not forwarding
0x190aca0 (latency) query
0:00:23.014672412 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3938:gst_pad_query:<enc_tx_videoparse:src> sent query 0x190aca0
(latency), result 1
0:00:23.014745701 25082      0x1710600 DEBUG           videoencoder
gstvideoencoder.c:1262:gst_video_encoder_src_query_default:<enc_tx_enc>
Peer latency: live 0, min 0:00:00.000000000 max 99:99:99.999999999
0:00:23.014782668 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3938:gst_pad_query:<enc_tx_enc:src> sent query 0x190aca0
(latency), result 1
0:00:23.014823211 25082      0x1710600 LOG                 GST_PADS
gstpad.c:3216:query_latency_default_fold:<enc_tx_rtppay:sink> got latency
live:false min:0 max:-1
0:00:23.014909482 25082      0x1710600 LOG                 GST_PADS
gstpad.c:3287:gst_pad_query_latency_default:<enc_tx_rtppay:src> got latency
live:false min:0 max:-1
0:00:23.014937584 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3372:gst_pad_query_default:<enc_tx_rtppay:src> not forwarding
0x190aa30 (latency) query
0:00:23.014991787 25082      0x1710600 DEBUG               GST_PADS
gstpad.c:3938:gst_pad_query:<enc_tx_rtppay:src> sent query 0x190aa30
(latency), result 1
0:00:23.015118808 25082      0x1710600 DEBUG               basesink
gstbasesink.c:1162:gst_base_sink_query_latency:<enc_tx_sink> latency query:
live: 1, have_latency 1, upstream: 0, min 0:00:00.000000000, max
99:99:99.999999999
0:00:23.015140338 25082      0x1710600 DEBUG               basesink
gstbasesink.c:4915:default_element_query:<enc_tx_sink> query latency
returns 1
DELAY: min_latency 0 0:00:00.000000000ms







On 14 March 2018 at 13:29, Baby Octopus <jagadishkamathk at gmail.com> wrote:

> To get latency, do a query through gst_query_parse_latency() and get the
> min_latency. Max latency will
> you the max amount of time the data can get buffered in the pipeline
>
> ~BO
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180315/0d693dec/attachment.html>


More information about the gstreamer-devel mailing list