summaryrefslogtreecommitdiffstats
path: root/src/plugins/android/src/wrappers/jni/androidcamera.cpp
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-05-05 16:40:05 +0200
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-05-27 12:18:43 +0000
commit83d1255080ab2be678efbbc42e259c9681619619 (patch)
tree388001d4957d71fc672b8fda41ef022118317a12 /src/plugins/android/src/wrappers/jni/androidcamera.cpp
parent008d57e1d7c8208d5ac415db5a4bdd558688d638 (diff)
Android: fix setting the camera preview resolution.
- When the video capture resolution or the image capture resolution changes, we now always set the viewfinder resolution to the highest available one with the same aspect ratio as the capture resolution. We were previously not doing anything if the new capture resolution had the same aspect ratio as the current viewfinder resolution. - Some devices don't support using a viewfinder resolution different from the video capture resolution. Make sure we handle this case. Change-Id: I8d3ab7b01c56ed78d1ca838a522ba459692fc332 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/plugins/android/src/wrappers/jni/androidcamera.cpp')
-rw-r--r--src/plugins/android/src/wrappers/jni/androidcamera.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/android/src/wrappers/jni/androidcamera.cpp b/src/plugins/android/src/wrappers/jni/androidcamera.cpp
index d9c8befaf..7496e9cdc 100644
--- a/src/plugins/android/src/wrappers/jni/androidcamera.cpp
+++ b/src/plugins/android/src/wrappers/jni/androidcamera.cpp
@@ -786,6 +786,9 @@ QSize AndroidCameraPrivate::getPreferredPreviewSizeForVideo()
QJNIObjectPrivate size = m_parameters.callObjectMethod("getPreferredPreviewSizeForVideo",
"()Landroid/hardware/Camera$Size;");
+ if (!size.isValid())
+ return QSize();
+
return QSize(size.getField<jint>("width"), size.getField<jint>("height"));
}