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

QML Video crashes on macOS when lazy-loaded

    XMLWordPrintable

Details

    • macOS
    • 2e43d29e1 (dev), 3e23caf2d (6.5.0), 0a51a9a2e (6.5)

    Description

      When using a QML Video on macOS, which is loaded at a later point during runtime e.g. with a Loader item the video will crash as soon as the play() method is called.

      Example QML:

      import QtQuick
      import QtQuick.Controls
      import QtMultimedia
      
      Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Video")
      
        Button {
          text: !testLoader.item ? "Load Video" : "Play Video"
          anchors.centerIn: parent
          onClicked: {
            if(!testLoader.item)
              testLoader.active = true
            else
              testLoader.item.play()
          }
          background: Rectangle { color: parent.down ? "darkgrey" : "black" }
        }
      
        Loader {
          id: testLoader
          anchors.fill: parent
          sourceComponent: videoComp
          active: false // change this to true and the video can play correctly!
        }
      
        Component {
          id: videoComp
          Video {
            anchors.fill: parent
            source: "https://felgo.com/web-assets/video.mp4"
          }
        }
      }
       

      When the Loader is changed to active: true the video can load and play just fine. If the video Item is lazy-loaded the application crashes when play() is called. It is a common use-case for us to show videos on some sub-pages in the application that are loaded on-demand.

      This is the log output when the crash happens:

      2023-02-01 18:05:48.632 appQt6QuickApp[32273:1913108] -[__NSCFData objectForKey:]: unrecognized selector sent to instance 0x6000027c6a00
      2023-02-01 18:05:48.636 appQt6QuickApp[32273:1913108] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFData objectForKey:]: unrecognized selector sent to instance 0x6000027c6a00'
      *** First throw call stack:
      (
          0   CoreFoundation                      0x00007ff80228e40b __exceptionPreprocess + 242
          1   libobjc.A.dylib                     0x00007ff801ddae25 objc_exception_throw + 48
          2   CoreFoundation                      0x00007ff80232554b -[NSObject(NSObject) __retain_OA] + 0
          3   CoreFoundation                      0x00007ff8021f864b ___forwarding___ + 1324
          4   CoreFoundation                      0x00007ff8021f8088 _CF_forwarding_prep_0 + 120
          5   CoreVideo                           0x00007ff80a45953b CVPixelBufferCreateResolvedAttributesDictionary + 149
          6   VideoToolbox                        0x00007ff80f4a2c70 VTPixelBufferAttributesMediatorCopyProperty + 484
          7   AVFCore                             0x00007ff815e36170 -[AVPlayerItem(AVPlayerItemOutputs) _preferredPixelBufferAttributes] + 53
          8   AVFCore                             0x00007ff815e05708 __84-[AVPlayer _updateCurrentItemPreferredPixelBufferAttributesAndVideoLayerSuppression]_block_invoke + 76
          9   libdispatch.dylib                   0x00007ff801fbaa44 _dispatch_client_callout + 8
          10  libdispatch.dylib                   0x00007ff801fc836b _dispatch_lane_barrier_sync_invoke_and_complete + 60
          11  AVFCore                             0x00007ff815e056b6 -[AVPlayer _updateCurrentItemPreferredPixelBufferAttributesAndVideoLayerSuppression] + 73
          12  CoreFoundation                      0x00007ff80220b3e3 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 120
          13  CoreFoundation                      0x00007ff8022a543a ___CFXRegistrationPost_block_invoke + 88
          14  CoreFoundation                      0x00007ff8022a5389 _CFXRegistrationPost + 536
          15  CoreFoundation                      0x00007ff8021de919 _CFXNotificationPost + 735
          16  AVFCore                             0x00007ff815e36242 -[AVPlayerItem(AVPlayerItemOutputs) _addVideoOutput:] + 195
          17  AVFCore                             0x00007ff815e3652d -[AVPlayerItem(AVPlayerItemOutputs) addOutput:] + 264
          18  libdarwinmediaplugin.dylib          0x00000001169a333d libdarwinmediaplugin.dylib + 99133
          19  libdarwinmediaplugin.dylib          0x00000001169a3164 libdarwinmediaplugin.dylib + 98660
          20  QtCore                              0x0000000107f07b07 _ZN11QMetaObject8activateEP7QObjectPKS_iPPv + 3959
          21  libdarwinmediaplugin.dylib          0x0000000116994974 libdarwinmediaplugin.dylib + 39284
          22  libdarwinmediaplugin.dylib          0x0000000116998ac3 libdarwinmediaplugin.dylib + 56003
          23  QtCore                              0x0000000107eb7596 _ZN23QCoreApplicationPrivate13notify_helperEP7QObjectP6QEvent + 310
          24  QtCore                              0x0000000107eb71aa _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent + 170
          25  QtCore                              0x0000000107eb8163 _ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData + 803
          26  libqcocoa.dylib                     0x000000010693480b qt_plugin_instance + 60235
          27  libqcocoa.dylib                     0x0000000106934f1b qt_plugin_instance + 62043
          28  CoreFoundation                      0x00007ff802215b98 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
          29  CoreFoundation                      0x00007ff802215b47 __CFRunLoopDoSource0 + 157
          30  CoreFoundation                      0x00007ff802215921 __CFRunLoopDoSources0 + 212
          31  CoreFoundation                      0x00007ff80221459b __CFRunLoopRun + 929
          32  CoreFoundation                      0x00007ff802213b80 CFRunLoopRunSpecific + 560
          33  HIToolbox                           0x00007ff80bb58766 RunCurrentEventLoopInMode + 292
          34  HIToolbox                           0x00007ff80bb58576 ReceiveNextEventCommon + 679
          35  HIToolbox                           0x00007ff80bb582b3 _BlockUntilNextEventMatchingListInModeWithFilter + 70
          36  AppKit                              0x00007ff80535ff33 _DPSNextEvent + 909
          37  AppKit                              0x00007ff80535edb4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1219
          38  AppKit                              0x00007ff8053513f7 -[NSApplication run] + 586
          39  libqcocoa.dylib                     0x0000000106933d2c qt_plugin_instance + 57452
          40  QtCore                              0x0000000107ec0236 _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE + 486
          41  QtCore                              0x0000000107eb77a5 _ZN16QCoreApplication4execEv + 133
          42  appQt6QuickApp                      0x00000001056ee70a main + 266
          43  dyld                                0x00007ff801e07310 start + 2432
      )
      libc++abi: terminating with uncaught exception of type NSException 

      Attachments

        Issue Links

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

          Activity

            People

              dorisverria Doris Verria
              GTDev Günther Teufl
              Votes:
              10 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes