summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcKe <herderkewitz@googlemail.com>2015-02-01 11:29:01 +0100
committerrogersb11 <brettrogers11@gmail.com>2016-01-16 03:18:29 -0500
commit27db785d781822af7376a9e65a48dc1b5956ff40 (patch)
tree8cb9848c6fc3ec7e3ee2ae8cd1ecb4ff732190c8
parent1cd1768436d1004bce888e4013a3a35f2afabb3f (diff)
downloaddevice_samsung_smdk4412-common-27db785d781822af7376a9e65a48dc1b5956ff40.zip
device_samsung_smdk4412-common-27db785d781822af7376a9e65a48dc1b5956ff40.tar.gz
device_samsung_smdk4412-common-27db785d781822af7376a9e65a48dc1b5956ff40.tar.bz2
Fix crash when switching between cameras
Conflicts: camera/exynos_camera.c Change-Id: I38b41feb4d0880b32fa847a907f50a7c2dc95cd6
-rw-r--r--camera/exynos_camera.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/camera/exynos_camera.c b/camera/exynos_camera.c
index 8501bea..3021ff5 100644
--- a/camera/exynos_camera.c
+++ b/camera/exynos_camera.c
@@ -2364,10 +2364,14 @@ int exynos_camera_preview(struct exynos_camera *exynos_camera)
}
if (exynos_camera->preview_window != NULL && exynos_camera->gralloc != NULL) {
- exynos_camera->preview_window->dequeue_buffer(exynos_camera->preview_window, &window_buffer, &window_stride);
- exynos_camera->gralloc->lock(exynos_camera->gralloc, *window_buffer, GRALLOC_USAGE_SW_WRITE_OFTEN, 0, 0, width, height, &window_data);
+ int ret = exynos_camera->preview_window->dequeue_buffer(exynos_camera->preview_window, &window_buffer, &window_stride);
+ if (ret < 0) {
+ ALOGE("%s: Error in dequeueing buffer", __func__);
+ goto error;
+ }
+ ret = exynos_camera->gralloc->lock(exynos_camera->gralloc, *window_buffer, GRALLOC_USAGE_YUV_ADDR | GRALLOC_USAGE_SW_WRITE_OFTEN, 0, 0, width, height, &window_data);
- if (window_data == NULL) {
+ if (window_data == NULL || ret == -EINVAL) {
ALOGE("%s: Unable to lock gralloc", __func__);
goto error;
}