From ad3d2afae99506a779ad758f4e7385c9f0b163ba Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Tue, 18 Feb 2020 18:23:31 +0100 Subject: AVF: Don't override AVPlayerLayer's bounds if already set AVPlayerLayer's bounds can be changed while resizing, and should not be overridden by default/native size. Fixes: QTBUG-65536 Change-Id: I771b13e58606663ded80df3665454007d28836b7 Reviewed-by: Timur Pocheptsov --- src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm') diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm index 1f13fc9bb..ba902a53c 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm @@ -875,9 +875,11 @@ void AVFMediaPlayerSession::processLoadStateChange(QMediaPlayer::State newState) // Get the native size of the video, and reset the bounds of the player layer AVPlayerLayer *playerLayer = [static_cast(m_observer) playerLayer]; if (videoTrack && playerLayer) { - playerLayer.bounds = CGRectMake(0.0f, 0.0f, - videoTrack.naturalSize.width, - videoTrack.naturalSize.height); + if (!playerLayer.bounds.size.width || !playerLayer.bounds.size.height) { + playerLayer.bounds = CGRectMake(0.0f, 0.0f, + videoTrack.naturalSize.width, + videoTrack.naturalSize.height); + } if (m_videoOutput && newState != QMediaPlayer::StoppedState) { m_videoOutput->setLayer(playerLayer); -- cgit v1.2.3