sim/video: call validate_buf when set_buf

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
This commit is contained in:
Peter Bee 2022-12-16 13:05:59 +08:00 committed by Xiang Xiao
parent 077c790830
commit 71c34d6391

View File

@ -101,13 +101,13 @@ static const struct imgsensor_ops_s g_sim_video_ops =
static const struct imgdata_ops_s g_sim_video_data_ops =
{
.init = sim_video_data_init,
.uninit = sim_video_data_uninit,
.validate_buf = sim_video_data_validate_buf,
.set_buf = sim_video_data_set_buf,
.validate_frame_setting = sim_video_data_validate_frame_setting,
.start_capture = sim_video_data_start_capture,
.stop_capture = sim_video_data_stop_capture,
.init = sim_video_data_init,
.uninit = sim_video_data_uninit,
.validate_buf = sim_video_data_validate_buf,
.set_buf = sim_video_data_set_buf,
.validate_frame_setting = sim_video_data_validate_frame_setting,
.start_capture = sim_video_data_start_capture,
.stop_capture = sim_video_data_stop_capture,
};
static sim_video_priv_t g_sim_video_priv;
@ -190,6 +190,11 @@ static int sim_video_data_validate_buf(uint8_t *addr, uint32_t size)
static int sim_video_data_set_buf(uint8_t *addr, uint32_t size)
{
if (sim_video_data_validate_buf(addr, size) < 0)
{
return -EINVAL;
}
g_sim_video_priv.next_buf = addr;
g_sim_video_priv.buf_size = size;
return 0;