Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.4
-
None
Description
Video frame converter invoked by frame.toImage() crashes when working with video frame textures on a different thread than the thread rendering pictures from QVideoOutput.
Example app
#include <QApplication> #include <QMediaPlayer> #include <QVideoFrame> #include <QVideoWidget> #include <QVideoSink> #include <QWindow> #include <QThread> #include <QTimer> #include <QLabel> #include <QPixmap> class SecondThread : public QThread { Q_OBJECT public slots: void convertFrame(const QVideoFrame &frame) { emit newImage(frame.toImage()); } signals: void newImage(const QImage &img); }; int main(int argc, char *argv[]) { QApplication a(argc, argv); QLabel label; label.show(); QVideoWidget widget; widget.show(); QMediaPlayer player; player.setVideoOutput(&widget); QTimer::singleShot(500, [&](){ player.setSource(QUrl("somemovie.mp4")); player.play(); }); SecondThread t2; t2.start(); t2.moveToThread(&t2); QObject::connect(widget.videoSink(), &QVideoSink::videoFrameChanged, &t2, &SecondThread::convertFrame); QObject::connect(&t2, &SecondThread::newImage, &a, [&](const QImage &img){ label.setPixmap(QPixmap::fromImage(img)); }); return a.exec(); } #include "main.moc"
Attachments
Issue Links
- covers
-
QTBUG-97789 Listening on QVideoSink::videoFrameChanged on Android fails to map/unmap QVideoFrame
-
- Closed
-
- relates to
-
QTBUG-113327 QVideoFrame::map() segfaults on 32bit android
-
- Closed
-