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

QMediaCaptureSession crashes with QCoreApplication

    XMLWordPrintable

Details

    • macOS
    • 4b73ae6531 (qt/qtmultimedia/dev) 4b73ae6531 (qt/tqtc-qtmultimedia/dev) d9f17add9e (qt/qtmultimedia/6.3) d9f17add9e (qt/tqtc-qtmultimedia/6.3) d9f17add9e (qt/tqtc-qtmultimedia/6.3.1) 77bd332b9c (qt/tqtc-qtmultimedia/6.2) 4b73ae6531 (qt/qtmultimedia/6.4)

    Description

      I'm trying to write a GUI-less application that can capture video from webcam.

      With `QCoreApplication` and not `QApplication`,

      `QMediaCaptureSession::setCamera` crashes with

      `qt.core.qobject.connect: QObject::connect: Cannot connect (nullptr)::orientationChanged(Qt::ScreenOrientation) to QVideoOutputOrientationHandler::screenOrientationChanged(Qt::ScreenOrientation)`

       

      Reproduce:

      ```
      #include <QtWidgets>
      #include <QMediaCaptureSession>
      #include <QCamera>
      #include <QVideoSink>
      #include <QObject>

      int main(int argc, char *argv[])
      {
      QCoreApplication app(argc, argv);
      // QApplication app(argc, argv);

      QCamera camera;
      QMediaCaptureSession session;
      session.setCamera(&camera);
      QVideoSink videoSink;
      session.setVideoSink(&videoSink);

      QObject::connect(&videoSink, &QVideoSink::videoFrameChanged, []()

      { qDebug() << "frame received"; }

      );

      camera.start();

      returnapp.exec();
      };
      ```

      Attachments

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

        Activity

          People

            anrocha André De La Rocha (Inactive)
            zhutq Athena Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes