Qmlsink Gstreamer Structures Delay Problem

Hello, I wrote a new structure with qmlsink for the Qgc application. The purpose of this structure is to display a broadcast with an rtsp address in real time in qgc. I compile and run Qgc for Android. I define the elements one by one in the Qmlsink structure, but as the camera image movement increases or as time passes, the delay increases. I have done a lot of research on this subject, but I have not made any progress. How can I prevent this delay and how can I transfer it in real time? Can you help me with this?

void GStreamerQmlSink::startStream(const QString &url, QQuickItem *videoItem)
{
    if (pipeline) {
        qWarning() << "Stream already running.";
        return;
    }
pipeline = gst_pipeline_new(nullptr);
    GstElement *src = gst_element_factory_make("rtspsrc", nullptr);
    GstElement *jitterbuffer = gst_element_factory_make("rtpjitterbuffer", nullptr);
    GstElement *rtph264depay = gst_element_factory_make("rtph264depay", nullptr);
    GstElement *h264parse = gst_element_factory_make("h264parse", nullptr);
    GstElement *decoder = gst_element_factory_make("avdec_h264", nullptr);
    GstElement *videoconvert = gst_element_factory_make("videoconvert", nullptr);
    GstElement *queue = gst_element_factory_make("queue", nullptr);
    GstElement *glupload = gst_element_factory_make("glupload", nullptr);
    GstElement *glcolorconvert = gst_element_factory_make("glcolorconvert", nullptr);
    qmlglsink = gst_element_factory_make("qmlglsink", nullptr);

    if (!src || !jitterbuffer || !rtph264depay || !h264parse || !decoder || !videoconvert || !queue || !glupload || !glcolorconvert || !qmlglsink) {
        qCritical() << "Failed to create GStreamer elements.";
        return;
    }
g_object_set(G_OBJECT(src), "location", "rtsp://127.0.0.1:8554/stream", "latency", 0, nullptr); 
    g_object_set(G_OBJECT(jitterbuffer), "latency", 10, nullptr);
    g_object_set(G_OBJECT(qmlglsink), "sync", FALSE, nullptr);

    gst_bin_add_many(GST_BIN(pipeline), src, jitterbuffer, rtph264depay, h264parse, decoder, videoconvert, queue, glupload, glcolorconvert, qmlglsink, nullptr);

    gst_element_link_many(jitterbuffer, rtph264depay, h264parse, decoder, videoconvert, queue, glupload, glcolorconvert, qmlglsink, nullptr);

    g_signal_connect(src, "pad-added", G_CALLBACK(+[](GstElement *src, GstPad *pad, GstElement *sink) {
                         GstPad *sinkpad = gst_element_get_static_pad(sink, "sink");
                         gst_pad_link(pad, sinkpad);
                         gst_object_unref(sinkpad);
                     }), jitterbuffer);
    g_object_set(G_OBJECT(qmlglsink), "widget", videoItem, nullptr);

    gst_element_set_state(pipeline, GST_STATE_PLAYING);
}

How do I fix this delay and configure my broadcast stream to real time? I would appreciate your help.

Do you see similar behaviour from command line? Sink sync=false may cause problems. Also I used to create elements and link them together but I was getting random problems. Then I switched to using gst_parse_launch and gst_bin_get_by_name and never looked back…

It looks like your pipeline does not have hardware acceleration.

hardware accelerators not working on android build. When I give hardware accelerator decoders like nvdec, nvv4l2decoder, nvvideoconvert, etc. pipeline doesn’t work for android and I can’t see the camera feed

this is an old thread, not sure it helps.

While the code I wrote works in real time in low light environments, there is an increasing delay in light environments. I think this is related to the alpha image channel. How can I progress in this regard?