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

QML MediaPlayer crashes if nested inside VideoOutput

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.13.0
    • Fix Version/s: 5.12.6, 5.13.2, 5.14.0 Alpha
    • Component/s: Multimedia
    • Labels:
    • Environment:
      Windows 7, AMD64
    • Platform/s:
      Windows
    • Commits:
      012affe3194a48d8bb10d0a100f1d1bbb24ecf7e (qt/qtmultimedia/5.12)

      Description

      If a QML MediaPlayer is nested as the source of a QML VideoOutput

          VideoOutput {
              anchors.fill: parent
              source:  MediaPlayer {
                  source: "..."
               }
          }
      

      A crash "read access violation: *this was 10" occurs when closing the window at the following call stack

      	Qt5Multimediad.dll!QScopedPointer<QAbstractVideoSurfacePrivate,QScopedPointerDeleter<QAbstractVideoSurfacePrivate> >::operator->() Line 118	C++
       	Qt5Multimediad.dll!qGetPtrHelper<QScopedPointer<QAbstractVideoSurfacePrivate,QScopedPointerDeleter<QAbstractVideoSurfacePrivate> > >(const QScopedPointer<QAbstractVideoSurfacePrivate,QScopedPointerDeleter<QAbstractVideoSurfacePrivate> > & ptr) Line 1055	C++
       	Qt5Multimediad.dll!QAbstractVideoSurface::d_func() Line 99	C++
       	Qt5Multimediad.dll!QAbstractVideoSurface::isActive() Line 264	C++
       	dsengined.dll!EVRCustomPresenter::flush() Line 1146	C++
       	dsengined.dll!EVRCustomPresenter::OnClockStop(__int64 __formal) Line 892	C++
       	evr.dll!CEVRFilter::Stop(void)	Unknown
       	quartz.dll!CFilterGraph::Stop(void)	Unknown
       	quartz.dll!CFGControl::CImplMediaControl::Stop(void)	Unknown
       	dsengined.dll!DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker * locker) Line 1364	C++
       	dsengined.dll!DirectShowPlayerService::run() Line 1735	C++
       	dsengined.dll!DirectShowPlayerServiceThread::run() Line 118	C++
       	Qt5Cored.dll!QThreadPrivate::start(void * arg) Line 403	C++
      

      The crash in this thread occurs while the main thread is waiting for the thread within the QDeclarativeVideoOutput destructor, at.

       	kernel32.dll!WaitForMultipleObjects()	Unknown
       	dsengined.dll!DirectShowEventLoop::wait(QMutex * mutex) Line 96	C++
       	dsengined.dll!DirectShowPlayerService::setVideoOutput(IBaseFilter * filter) Line 1296	C++
       	dsengined.dll!DirectShowPlayerService::videoOutputChanged() Line 1455	C++
       	dsengined.dll!DirectShowPlayerService::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 82	C++
       	Qt5Cored.dll!QMetaObject::activate(QObject * sender, int signalOffset, int local_signal_index, void * * argv) Line 3810	C++
       	Qt5Cored.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 3659	C++
       	dsengined.dll!DirectShowVideoRendererControl::filterChanged() Line 133	C++
       	dsengined.dll!DirectShowVideoRendererControl::setSurface(QAbstractVideoSurface * surface) Line 120	C++
       	Qt5MultimediaQuickd.dll!QDeclarativeVideoRendererBackend::releaseControl() Line 206	C++
       	Qt5MultimediaQuickd.dll!QDeclarativeVideoRendererBackend::~QDeclarativeVideoRendererBackend() Line 97	C++
       	Qt5MultimediaQuickd.dll!QDeclarativeVideoRendererBackend::`scalar deleting destructor'(unsigned int)	C++
       	Qt5MultimediaQuickd.dll!QScopedPointerDeleter<QDeclarativeVideoBackend>::cleanup(QDeclarativeVideoBackend * pointer) Line 60	C++
       	Qt5MultimediaQuickd.dll!QScopedPointer<QDeclarativeVideoBackend,QScopedPointerDeleter<QDeclarativeVideoBackend> >::reset(QDeclarativeVideoBackend * other) Line 160	C++
       	Qt5MultimediaQuickd.dll!QDeclarativeVideoOutput::~QDeclarativeVideoOutput() Line 146	C++
       	declarative_multimediad.dll!QQmlPrivate::QQmlElement<QDeclarativeVideoOutput>::~QQmlElement<QDeclarativeVideoOutput>() Line 108	C++
       	declarative_multimediad.dll!QQmlPrivate::QQmlElement<QDeclarativeVideoOutput>::`scalar deleting destructor'(unsigned int)	C++
       	Qt5Cored.dll!QObjectPrivate::deleteChildren() Line 2019	C++
       	Qt5Cored.dll!QObject::~QObject() Line 1032	C++
       	Qt5Guid.dll!QWindow::~QWindow() Line 221	C++
       	Qt5Quickd.dll!QQuickWindow::~QQuickWindow() Line 1365	C++
      

      So it appears to be aware it that the videoOutput is tearing down and needs to be released, but something is happening in the wrong order.

      If the QML is changed to make the VideoOutput and MediaPlayer items siblings, rather than parent-child, the crash is avoided.

          MediaPlayer {
              id: player
              source: "..."
          }
          VideoOutput {
              anchors.fill: parent
              source:  player
          }
      

      With this arrangement, the MediaPlayer element (QDeclarativeAudio) is destroyed before the VideoOutput is.

      >	declarative_multimediad.dll!QDeclarativeAudio::~QDeclarativeAudio() Line 127	C++
       	declarative_multimediad.dll!QQmlPrivate::QQmlElement<QDeclarativeAudio>::~QQmlElement<QDeclarativeAudio>() Line 108	C++
       	declarative_multimediad.dll!QQmlPrivate::QQmlElement<QDeclarativeAudio>::`scalar deleting destructor'(unsigned int)	C++
       	Qt5Cored.dll!QObjectPrivate::deleteChildren() Line 2019	C++
      
      >	Qt5MultimediaQuickd.dll!QDeclarativeVideoOutput::~QDeclarativeVideoOutput() Line 144	C++
       	declarative_multimediad.dll!QQmlPrivate::QQmlElement<QDeclarativeVideoOutput>::~QQmlElement<QDeclarativeVideoOutput>() Line 108	C++
       	declarative_multimediad.dll!QQmlPrivate::QQmlElement<QDeclarativeVideoOutput>::`scalar deleting destructor'(unsigned int)	C++
       	Qt5Cored.dll!QObjectPrivate::deleteChildren() Line 2019	C++
      

      Though this "fix" doesn't seem very robust , since I don't think QML particularly (or deleteChildren) particualrly promise any specific order in which siblings to be destroyed.

      This crash is a regression from 5.12.4, in which no crash occured with either arrangement of the QML items.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              valentyn.doroshchuk Valentyn Doroshchuk
              Reporter:
              puetzk Kevin Puetz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes