From fc50058455536b857d101166f8c003e83aed4f99 Mon Sep 17 00:00:00 2001
From: Maurice Kalinowski <maurice.kalinowski@qt.io>
Date: Tue, 20 Dec 2016 15:41:15 +0100
Subject: [PATCH] winrt: Fix video playback

Rendering should only be activated once the video frame size is known.
Otherwise the texture is created with an invalid size and rendering will
be stopped. This happens for some codecs where
MF_MEDIA_ENGINE_EVENT_LOADEDMETADATA is not known instantly after
loading video files.

Task-number: QTBUG-57707
Change-Id: Ic2347c8606239770e129544fd228b96929ed6198
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
---
 src/plugins/winrt/qwinrtmediaplayercontrol.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp
index 5720488f2..a4df6306f 100644
--- a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp
+++ b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp
@@ -267,7 +267,8 @@ public:
         }
 
         if (d->videoRenderer)
-            d->videoRenderer->setActive(d->state == QMediaPlayer::PlayingState);
+            d->videoRenderer->setActive(d->state == QMediaPlayer::PlayingState &&
+                                        d->videoRenderer->size().isValid());
 
         const QMediaPlayer::MediaStatus oldMediaStatus = d->mediaStatus;
         const QMediaPlayer::State oldState = d->state;
-- 
GitLab