From a8123e737140719549252806e0e6a1c121359f79 Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Thu, 2 Jan 2020 14:22:07 +0100 Subject: AVF: Don't apply settings if the camera is not active yet In macOS, a capture session can still automatically configure the capture format after you make changes. If frame rates are applied to the capture device and the camera is still not active, these rates will be overridden by old values when the capture session will be started. For this purpose lockForConfiguration is currently used within startRunning method of capture session. But in case if the settings are already applied to the capture device, we don't call lockForConfiguration within starting of the capture session (since it is needed to be called only when the settings have been changed). Suggesting to postpone setting of the format (to the capture device) until the camera is started. This will lead to apply settings before startRunning method with proper configuration lock. Fixes: QTBUG-81048 Change-Id: I04664e7b63474ce28571e888e524170b995a38d6 Reviewed-by: Andy Shaw --- src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm b/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm index a77d7de03..91f3cb7dc 100644 --- a/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm +++ b/src/plugins/avfoundation/camera/avfcameraviewfindersettingscontrol.mm @@ -185,7 +185,6 @@ void AVFCameraViewfinderSettingsControl2::setViewfinderSettings(const QCameraVie return; m_settings = settings; - applySettings(m_settings); } QVideoFrame::PixelFormat AVFCameraViewfinderSettingsControl2::QtPixelFormatFromCVFormat(unsigned avPixelFormat) -- cgit v1.2.3 From ee50d9a38689c2d56d530ef41f94ee0f6844b571 Mon Sep 17 00:00:00 2001 From: Val Doroshchuk Date: Mon, 13 Jan 2020 14:40:35 +0100 Subject: AVF: Set the stopped state before emitting the status after EOS Fixed a bug when the media status was changed and emitted, but the state was kept old, this prevented to start playing again in a loop if the loops were requested. This is a regression since 9dbdd5d. Fixes: QTBUG-81122 Change-Id: Id2c7d03a25cc22f7f45c6017d2da0af9bb52e528 Reviewed-by: Timur Pocheptsov --- src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm index 3c59419e7..3e3736183 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm @@ -825,8 +825,6 @@ void AVFMediaPlayerSession::processEOS() #endif Q_EMIT positionChanged(position()); m_mediaStatus = QMediaPlayer::EndOfMedia; - Q_EMIT mediaStatusChanged(m_mediaStatus); - m_state = QMediaPlayer::StoppedState; // At this point, frames should not be rendered anymore. @@ -834,6 +832,7 @@ void AVFMediaPlayerSession::processEOS() if (m_videoOutput) m_videoOutput->setLayer(nullptr); + Q_EMIT mediaStatusChanged(m_mediaStatus); Q_EMIT stateChanged(m_state); } -- cgit v1.2.3