Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsVideoItem continuous repaint?
Forum Updated to NodeBB v4.3 + New Features

QGraphicsVideoItem continuous repaint?

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 3 Posters 933 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    davecotter
    wrote on last edited by davecotter
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • nageshN Offline
        nageshN Offline
        nagesh
        wrote on last edited by
        #3

        @davecotter Does the application has timer instance running which is calling update ?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          davecotter
          wrote on last edited by davecotter
          #4

          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

          1 Reply Last reply
          0
          • D Offline
            D Offline
            davecotter
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              davecotter
              wrote on last edited by
              #6

              bug reported here, please upvote!

              1 Reply Last reply
              0
              • D Offline
                D Offline
                davecotter
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  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.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    davecotter
                    wrote on last edited by
                    #9

                    @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.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Then at least tell that on the report.

                      That will help the developer that will take the report to reproduce your situation more easily.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        davecotter
                        wrote on last edited by
                        #11

                        i had said to use that example, but i have now added the tidbit about "add a timer"

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved