Skip to content

Commit 5d5bbe2

Browse files
authored
v4l bytes_per_line_data: round the size up to the next byte
1 parent 3339d91 commit 5d5bbe2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/arvv4l2stream.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ arv_v4l2_stream_start_acquisition (ArvStream *stream, GError **error)
361361
return FALSE;
362362
}
363363

364-
bytes_per_line_data = thread_data->image_width * bit_per_pixel / 8;
364+
// round each line up to the next byte
365+
bytes_per_line_data = (thread_data->image_width * bit_per_pixel + 7) / 8;
365366
if (bytes_per_line < bytes_per_line_data) {
366367
g_set_error (error, ARV_DEVICE_ERROR, ARV_DEVICE_ERROR_PROTOCOL_ERROR,
367368
"Invalid v4l2 pixel format");

0 commit comments

Comments
 (0)