From f5a115a2a49d8eb92b45997879be05b5c8f259f0 Mon Sep 17 00:00:00 2001 From: VaL Doroshchuk Date: Thu, 29 Aug 2019 09:55:11 +0200 Subject: Fix crash when VideoOutput.sourceRect is requested but playback is stopped When the playback is stopped, QAbstractVideoSurface::stop is called where current surface format is reset. And when sourceRect is requested before QAbstractVideoSurface::surfaceFormatChanged() is handled, it produces an ASSERT. Suggesting to use cached surfaceFormat instead of removing the ASSERT. To reproduce: MediaPlayer { onStatusChanged: console.log(output.sourceRect) } Change-Id: I73ad72f1e4968fe45266827ec5c7e3b36333ee30 Reviewed-by: Timur Pocheptsov --- src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qtmultimediaquicktools') diff --git a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp index 5cb4689cc..40568d118 100644 --- a/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp +++ b/src/qtmultimediaquicktools/qdeclarativevideooutput_render.cpp @@ -390,8 +390,8 @@ QAbstractVideoSurface *QDeclarativeVideoRendererBackend::videoSurface() const QRectF QDeclarativeVideoRendererBackend::adjustedViewport() const { - const QRectF viewport = m_surface->surfaceFormat().viewport(); - const QSizeF pixelAspectRatio = m_surface->surfaceFormat().pixelAspectRatio(); + const QRectF viewport = m_surfaceFormat.viewport(); + const QSizeF pixelAspectRatio = m_surfaceFormat.pixelAspectRatio(); if (pixelAspectRatio.isValid()) { const qreal ratio = pixelAspectRatio.width() / pixelAspectRatio.height(); -- cgit v1.2.3