QGraphicsVideoItem continuous repaint?
-
On mac: I have a QGraphicsScene, and in that, I have a QGraphicsVideoItem displaying an mp4 file (1080p). That's it, there are no other layers. I find that even when the video is paused, the video continuously re-renders the video frame pixels, over and over, chewing up CPU. Any time i break in the debugger, even when paused, it is always deep inside the scene, painting the video frame. eg:
1 CGraphicsItem::paint(QPainter *, QStyleOptionGraphicsItem const *, QWidget *) 2 CGraphicsVideoItem::paint(QPainter *, QStyleOptionGraphicsItem const *, QWidget 3 QGraphicsScenePrivate::draw(QGraphicsItem *, QPainter *, QTransform const *, QT 4 QGraphicsScenePrivate::drawSubtreeRecursive(QGraphicsItem *, QPainter *, QTrans 5 QGraphicsScenePrivate::drawItems(QPainter *, QTransform const *, QRegion *, QWi 6 QGraphicsView::paintEvent(QPaintEvent *) 7 CGraphicsView::paintEvent(QPaintEvent *) 8 QWidget::event(QEvent *) 9 QFrame::event(QEvent *) 10 QGraphicsView::viewportEvent(QEvent *) 11 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *, QEvent *) 12 QApplicationPrivate::notify_helper(QObject *, QEvent *) 13 QApplication::notify(QObject *, QEvent *) 14 QCoreApplication::notifyInternal2(QObject *, QEvent *) 15 QWidgetPrivate::sendPaintEvent(QRegion const&) 16 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, QFlag 17 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, 18 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, QFlag 19 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, 20 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, QFlag 21 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, 22 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, QFlag 23 QWidgetRepaintManager::paintAndFlush() 24 QWidgetRepaintManager::sync() 25 QWidget::event(QEvent *) 26 QMainWindow::event(QEvent *) 27 QApplicationPrivate::notify_helper(QObject *, QEvent *) 28 QApplication::notify(QObject *, QEvent *) 29 QCoreApplication::notifyInternal2(QObject *, QEvent *) 30 QCoreApplication::sendEvent(QObject *, QEvent *) 31 QCoreApplicationPrivate::sendPostedEvents(QObject *, int, QThreadData *) 32 QGraphicsScenePrivate::_q_processDirtyItems() 33 QObject::event(QEvent *) 34 QApplicationPrivate::notify_helper(QObject *, QEvent *) 35 QApplication::notify(QObject *, QEvent *) 36 QCoreApplication::notifyInternal2(QObject *, QEvent *) 37 QCoreApplication::sendEvent(QObject *, QEvent *) 38 QCoreApplicationPrivate::sendPostedEvents(QObject *, int, QThreadData *) 39 QCocoaEventDispatcherPrivate::processPostedEvents() 40 QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void *) 41 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 42 __CFRunLoopDoSource0 43 __CFRunLoopDoSources0 44 __CFRunLoopRun 45 CFRunLoopRunSpecific 46 RunCurrentEventLoopInMode 47 ReceiveNextEventCommon 48 _BlockUntilNextEventMatchingListInModeWithFilter 49 _DPSNextEvent 50 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 51 -[NSApplication run] 52 QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 53 QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 54 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) 55 QCoreApplication::exec() 56 main 57 start
is this... expected?
apparently the function
update()
is not virtual, so i can't override it and catch it in the act... how can i find out who's causing this infinite-update loop? -
Hi,
I would be surprised as well however it could be related to the platform backend itself that might be doing something like pushing the same frame over and over while in pause.
I do not say it is that, just thinking out loud about what might be happening.
-
@davecotter Does the application has timer instance running which is calling update ?
-
nope, no timers that call update() (but i do have timers trying (and failing!) to do other things). you can see the same problem with "Video Graphics Item Example"
just open any HD video (1920x1080), start playing it, pause it, and break into the debugger.
you'll see it's wicked bizy rendering some pixels that it DEFINITELY doesn't need to
-
i also note that timers have a really hard time getting any cpu time while the video is playing.
video plays all smooth, that's nice, but the rest of the app slows to a crawl.
-
bug reported here, please upvote!
-
this is a horrible, show stopping problem, because timers don't fire when a video is playing.
even a 648x480 video, tiny by today's standards, on a modern, powerful computer, the app's timers come to a screeching halt, when playing OR when paused playing.
please upvote this bug, thanks.
-
You should add a minimal compilable example to your report.
Worth noting, the Qt Multimedia module is getting quite a big overhaul for Qt 6.2, you should check it out.
-
@davecotter said in QGraphicsVideoItem continuous repaint?:
Video Graphics Item Example
the minimal example is "Video Graphics Item Example" which is included with Qt. just add a timer and watch it not fire.
-
Then at least tell that on the report.
That will help the developer that will take the report to reproduce your situation more easily.
-
i had said to use that example, but i have now added the tidbit about "add a timer"