Fail on wrong resolution

This commit is contained in:
Kamil Trzcinski
2022-04-12 10:05:03 +02:00
parent ddca582551
commit ae18e06098
2 changed files with 8 additions and 3 deletions

View File

@ -73,8 +73,12 @@ static int camera_configure_jpeg_output(camera_t *camera, buffer_list_t *src_cap
int camera_configure_output(camera_t *camera, buffer_list_t *src_capture, int res)
{
return camera_configure_h264_output(camera, src_capture, res) == 0 &&
camera_configure_jpeg_output(camera, src_capture, res) == 0;
if (camera_configure_h264_output(camera, src_capture, res) < 0 ||
camera_configure_jpeg_output(camera, src_capture, res) < 0) {
return -1;
}
return 0;
}
int camera_configure_output_rescaler2(camera_t *camera, buffer_list_t *src_capture, float div, int res)

View File

@ -118,7 +118,8 @@ int v4l2_buffer_list_open(buffer_list_t *buf_list)
if (buf_list->fmt.width != fmt.width || buf_list->fmt.height != fmt.height) {
if (fmt.bytesperline) {
LOG_ERROR(buf_list, "Requested resolution=%ux%u is unavailable. Got %ux%u.",
LOG_ERROR(buf_list, "Requested resolution=%ux%u is unavailable. Got %ux%u. "
"Consider using the `-camera-high_res_factor=2` or `-camera-low_res_factor=3`",
fmt.width, fmt.height, buf_list->fmt.width, buf_list->fmt.height);
} else {
LOG_INFO(buf_list, "Requested resolution=%ux%u is unavailable. Got %ux%u. Accepted",