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

[REG 6.4.3-6.5.0] [darwin] QMediaPlayer produces invalid frames on custom QVideoSink

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.5.1, 6.6.0
    • 6.5.0, dev
    • Multimedia
    • None
    • MacBook Pro M1, 2020
      macOS Ventura 13.3.1
    • macOS
    • aa2b9b047 (dev), ea62bd143 (6.5)

    Description

      QMediaPlayer produces invalid frames on custom QVideoSink on macOS with 'darwin' backend. Regression on Qt 6.5.0, no such problem with Qt 6.4.3 and earlier.

      There is a sample project VideoPreview.zip , which generates image from the first video frame in C++ code and displays it in QML via custom image provider.

      C++ code (simplified):

      class VideoPreviewProvider : public QQuickImageProvider
      {
      public:
          VideoPreviewProvider() : QQuickImageProvider(QQuickImageProvider::Image) {}
          QImage requestImage(const QString &imageId, QSize *size, const QSize &requestedSize) override
          {
              QImage preview;
              QEventLoop loop;
      
              QVideoSink sink;
              QObject::connect(&sink, &QVideoSink::videoFrameChanged, [&] (const QVideoFrame& frame) {
                  if (!frame.isValid()) {
                      qDebug() << "invalid frame!";
                      return;
                  }
      
                  preview = frame.toImage();
                  loop.quit();
              });
      
              QMediaPlayer player;
              player.setVideoOutput(&sink);
              player.setSource(QUrl::fromLocalFile(imageId));
              player.play();
      
              loop.exec();
              return preview;
          }
      };
      

      Now all frames from QVideoSink came as invalid.

      Steps to reproduce:
      1. Build and run attached project
      2. Open any video

      Actual result: no video preview is displayed, warnings in output
      Expected result: video preview is displayed, no warnings

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-113286
          # Subject Branch Project Status CR V

          Activity

            People

              laknoll Lars Knoll
              studiosus Vladimir Belyavsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes