diff options
author | Yoann Lopes <yoann.lopes@qt.io> | 2016-07-13 11:15:45 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@qt.io> | 2016-08-12 11:18:42 +0000 |
commit | 95e1012c9dc49e0afbed52d17ff32a4a59a723f7 (patch) | |
tree | ecad1aa27667a1d6016c3cce75f23922906bace2 /src/plugins/android/src/wrappers | |
parent | 624ac719d6d3dd596fc697ce587cc6bb9e33845f (diff) |
Android: fix freeze when taking pictures on some devices
On some devices and on the emulator, the preview callback must be
cleared before taking a picture to avoid a camera server freeze.
Task-number: QTBUG-54709
Change-Id: I9e4ad417fa08cddea7edfd232f5b5df40ada59ee
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/plugins/android/src/wrappers')
-rw-r--r-- | src/plugins/android/src/wrappers/jni/androidcamera.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/android/src/wrappers/jni/androidcamera.cpp b/src/plugins/android/src/wrappers/jni/androidcamera.cpp index 0ce8eff39..b0e02b7c2 100644 --- a/src/plugins/android/src/wrappers/jni/androidcamera.cpp +++ b/src/plugins/android/src/wrappers/jni/androidcamera.cpp @@ -1436,6 +1436,11 @@ void AndroidCameraPrivate::takePicture() { QJNIEnvironmentPrivate env; + // We must clear the preview callback before calling takePicture(), otherwise the call will + // block and the camera server will be frozen until the next device restart... + // That problem only happens on some devices and on the emulator + m_cameraListener.callMethod<void>("clearPreviewCallback", "(Landroid/hardware/Camera;)V", m_camera.object()); + m_camera.callMethod<void>("takePicture", "(Landroid/hardware/Camera$ShutterCallback;" "Landroid/hardware/Camera$PictureCallback;" "Landroid/hardware/Camera$PictureCallback;)V", |