3
0

camera: Use frame size as returned by V4L2 to correct padding

Change-Id: I6d6154d4db468b809868b14bc84d669d168b413e
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
This commit is contained in:
Paul Kocialkowski 2013-07-30 23:12:56 +02:00
parent 5099a80f5a
commit dfbdcd31e1
2 changed files with 9 additions and 3 deletions

View File

@ -1764,7 +1764,7 @@ int exynos_camera_preview(struct exynos_camera *exynos_camera)
return -1; return -1;
} }
frame_size = (int) ((float) width * (float) height * format_bpp); frame_size = exynos_camera->preview_frame_size;
offset = index * frame_size; offset = index * frame_size;
preview_data = (void *) ((int) exynos_camera->preview_memory->data + offset); 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; return -1;
} }
if (rc != frame_size) if (rc < frame_size) {
ALOGE("%s: Frame size mismatch: %d/%d", __func__, frame_size, rc); 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) { if (exynos_camera->callbacks.request_memory != NULL) {
fd = exynos_v4l2_find_fd(exynos_camera, 0); fd = exynos_v4l2_find_fd(exynos_camera, 0);
if (fd < 0) { if (fd < 0) {

View File

@ -213,6 +213,7 @@ struct exynos_camera {
struct preview_stream_ops *preview_window; struct preview_stream_ops *preview_window;
camera_memory_t *preview_memory; camera_memory_t *preview_memory;
int preview_buffers_count; int preview_buffers_count;
int preview_frame_size;
int preview_params_set; int preview_params_set;
// Recording // Recording