Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-106257

QtMultimedia segfault when gstreamer plugins are missing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.5.0 Beta1
    • 6.3.1
    • Multimedia
    • None
    • Linux/Other display system
    • bf4e6b5065 (qt/qtmultimedia/dev) bf4e6b5065 (qt/tqtc-qtmultimedia/dev)

    Description

      The Qt Multimedia module causes a segfault due to an unhandled nullptr which might be returned by gstreamer when a certain plugin is missing.

      Root cause is in qgstreamervideooutput.cpp:

       

       QGstreamerVideoOutput::QGstreamerVideoOutput(QObject *parent)
      : QObject(parent),
      gstVideoOutput("videoOutput")
      {
      videoQueue = QGstElement("queue", "videoQueue");
      videoConvert = QGstElement("videoconvert", "videoConvert");  # <----
      videoSink = QGstElement("fakesink", "fakeVideoSink");
      videoSink.set("sync", true);
      gstVideoOutput.add(videoQueue, videoConvert, videoSink);
      if (!videoQueue.link(videoConvert, videoSink))
      qCDebug(qLcMediaVideoOutput) << ">>>>>> linking failed";
      
      gstVideoOutput.addGhostPad(videoQueue, "sink");
      }
      

       In our case, the "videoconvert" plugin was not included in the Buildroot image, causing videoConvert->m_object to be null. However, Qt Multimedia does not check this and later on passes the nullptr to the gstreamer API, which leads to a segfault in line 106:

      videoConvert.link(videoSink);

       

      Only when enabling detailed gstreamer logging, the error can be detected:

      0:00:41.549426673 4269 0x2126600 LOG GST_ELEMENT_FACTORY gstelementfactory.c:444:gst_element_factory_make: gstelementfactory: make "videoconvert" "videoConvert"
      0:00:41.549547675 4269 0x2126600 LOG GST_ELEMENT_FACTORY gstelementfactory.c:142:gst_element_factory_find: no such element factory "videoconvert"
      0:00:41.549607675 4269 0x2126600 WARN GST_ELEMENT_FACTORY gstelementfactory.c:462:gst_element_factory_make: no such element factory "videoconvert"!

       Excerpt from the debugger, showing that m_object is null for videoConvert:

        

       

      When we built Qt6 from source, it did not show any warning with regards to the missing plugin. Qt should check if the plugin is missing and abort the program gracefully with a useful error message, since this issue took us a lot of time to track down.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            piotr Piotr Srebrny (Inactive)
            syncu syncu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes