initialize struct v4l2_plane in mp_camera_*_buffer functions
without it ioctl parameter points to uninitialized value
This commit is contained in:
10
src/camera.c
10
src/camera.c
@@ -365,9 +365,9 @@ mp_camera_capture_buffer(MPCamera *camera, MPBuffer *buffer)
|
|||||||
buf.type = buftype;
|
buf.type = buftype;
|
||||||
buf.memory = V4L2_MEMORY_MMAP;
|
buf.memory = V4L2_MEMORY_MMAP;
|
||||||
|
|
||||||
struct v4l2_plane planes[1];
|
struct v4l2_plane planes = {};
|
||||||
if (camera->use_mplane) {
|
if (camera->use_mplane) {
|
||||||
buf.m.planes = planes;
|
buf.m.planes = &planes;
|
||||||
buf.length = 1;
|
buf.length = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ mp_camera_capture_buffer(MPCamera *camera, MPBuffer *buffer)
|
|||||||
|
|
||||||
uint32_t bytesused;
|
uint32_t bytesused;
|
||||||
if (camera->use_mplane) {
|
if (camera->use_mplane) {
|
||||||
bytesused = planes[0].bytesused;
|
bytesused = planes.bytesused;
|
||||||
} else {
|
} else {
|
||||||
bytesused = buf.bytesused;
|
bytesused = buf.bytesused;
|
||||||
}
|
}
|
||||||
@@ -419,9 +419,9 @@ mp_camera_release_buffer(MPCamera *camera, uint32_t buffer_index)
|
|||||||
buf.memory = V4L2_MEMORY_MMAP;
|
buf.memory = V4L2_MEMORY_MMAP;
|
||||||
buf.index = buffer_index;
|
buf.index = buffer_index;
|
||||||
|
|
||||||
struct v4l2_plane planes[1];
|
struct v4l2_plane planes = {};
|
||||||
if (camera->use_mplane) {
|
if (camera->use_mplane) {
|
||||||
buf.m.planes = planes;
|
buf.m.planes = &planes;
|
||||||
buf.length = 1;
|
buf.length = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user