summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-07-30 23:12:56 +0200
committerPaul Kocialkowski <contact@paulk.fr>2013-07-30 23:14:10 +0200
commitdfbdcd31e1da6be1545573bff5507825b063b987 (patch)
tree32a0fd435e01dde2f18f88b4ce2c6443b3b0a062
parent5099a80f5a8ac7a09588575563648acf35992792 (diff)
downloaddevice_samsung_galaxys2-common-dfbdcd31e1da6be1545573bff5507825b063b987.zip
device_samsung_galaxys2-common-dfbdcd31e1da6be1545573bff5507825b063b987.tar.gz
device_samsung_galaxys2-common-dfbdcd31e1da6be1545573bff5507825b063b987.tar.bz2
camera: Use frame size as returned by V4L2 to correct padding
Change-Id: I6d6154d4db468b809868b14bc84d669d168b413e Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--camera/exynos_camera.c11
-rw-r--r--camera/exynos_camera.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/camera/exynos_camera.c b/camera/exynos_camera.c
index 504cf4c..47d118d 100644
--- a/camera/exynos_camera.c
+++ b/camera/exynos_camera.c
@@ -1764,7 +1764,7 @@ int exynos_camera_preview(struct exynos_camera *exynos_camera)
return -1;
}
- frame_size = (int) ((float) width * (float) height * format_bpp);
+ frame_size = exynos_camera->preview_frame_size;
offset = index * frame_size;
preview_data = (void *) ((int) exynos_camera->preview_memory->data + offset);
@@ -1959,10 +1959,15 @@ int exynos_camera_preview_start(struct exynos_camera *exynos_camera)
return -1;
}
- if (rc != frame_size)
- ALOGE("%s: Frame size mismatch: %d/%d", __func__, frame_size, rc);
+ if (rc < frame_size) {
+ ALOGE("%s: problematic frame size: %d/%d", __func__, rc, frame_size);
+ return -1;
+ }
}
+ frame_size = rc;
+ exynos_camera->preview_frame_size = frame_size;
+
if (exynos_camera->callbacks.request_memory != NULL) {
fd = exynos_v4l2_find_fd(exynos_camera, 0);
if (fd < 0) {
diff --git a/camera/exynos_camera.h b/camera/exynos_camera.h
index 7ba0e48..d730e4a 100644
--- a/camera/exynos_camera.h
+++ b/camera/exynos_camera.h
@@ -213,6 +213,7 @@ struct exynos_camera {
struct preview_stream_ops *preview_window;
camera_memory_t *preview_memory;
int preview_buffers_count;
+ int preview_frame_size;
int preview_params_set;
// Recording