diff options
author | Samuel Mira <samuel.mira@qt.io> | 2021-10-01 15:40:23 +0300 |
---|---|---|
committer | Samuel Mira <samuel.mira@qt.io> | 2021-10-04 12:57:58 +0300 |
commit | 9263cca59a4952bb95c94d433b05c77cdcbb3e8e (patch) | |
tree | f0c35f1eea725de88ae74f68f877fea06c4b90c8 | |
parent | 078701abf256fb91cd9824cc8e6d48556200c1ef (diff) |
Fix incorrect video orientation for front camera
The current camera rotation on camera session is compensating the front
camera image for preview, but it seems the android is also compensating
when recording. So final video became flipped again.
Fixes: QTBUG-96943
Pick-to: 6.2
Change-Id: I0d08de15bab41926136c2a4b96154b9e2b5f5bb8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp b/src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp index 57dbbfb84..03eaa1545 100644 --- a/src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp +++ b/src/multimedia/platform/android/mediacapture/qandroidcapturesession.cpp @@ -182,7 +182,12 @@ void QAndroidCaptureSession::start(QMediaEncoderSettings &settings, const QUrl & m_mediaRecorder->setVideoEncodingBitRate(settings.videoBitRate()); m_mediaRecorder->setVideoEncoder(m_videoEncoder); - m_mediaRecorder->setOrientationHint(m_cameraSession->currentCameraRotation()); + // media recorder is also compensanting the mirror on front camera + auto rotation = m_cameraSession->currentCameraRotation(); + if (m_cameraSession->camera()->getFacing() == AndroidCamera::CameraFacingFront) + rotation = (360 - rotation) % 360; // remove mirror compensation + + m_mediaRecorder->setOrientationHint(rotation); } // Set audio encoder settings |