Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QmlSink Gstreamer Structures Delay Problem
Forum Updated to NodeBB v4.3 + New Features

QmlSink Gstreamer Structures Delay Problem

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 93 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Edanaz
    wrote on 30 Dec 2024, 09:08 last edited by Edanaz
    #1

    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.

    1 Reply Last reply
    0

    1/1

    30 Dec 2024, 09:08

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved