From 334905084977a6360826acbec5d18b4351d5f9d2 Mon Sep 17 00:00:00 2001 From: yair Date: Fri, 14 Nov 2025 19:11:55 +0200 Subject: [PATCH] Fix IDS uEye AOI issue with non-zero Y offset - Re-validate AOI configuration before starting video capture - Fixes 'Invalid buffer size' error when using Start Y > 0 - Query current AOI and re-set it to force SDK internal state update - Tested with Start Y=0 and Start Y=500 - both work correctly --- sys/idsueye/gstidsueyesrc.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/idsueye/gstidsueyesrc.c b/sys/idsueye/gstidsueyesrc.c index c9d1ba1..eb41f92 100644 --- a/sys/idsueye/gstidsueyesrc.c +++ b/sys/idsueye/gstidsueyesrc.c @@ -497,6 +497,12 @@ gst_idsueyesrc_start (GstBaseSrc * bsrc) SENSORINFO sInfo; ret = is_GetCameraInfo (src->hCam, &cInfo); ret = is_GetSensorInfo (src->hCam, &sInfo); + + /* Log sensor information for debugging AOI issues */ + if (ret == IS_SUCCESS) { + GST_DEBUG_OBJECT (src, "Sensor: %s, max size: %dx%d", + sInfo.strSensorName, sInfo.nMaxWidth, sInfo.nMaxHeight); + } } if (strlen (src->config_file)) { @@ -715,10 +721,20 @@ gst_idsueyesrc_create (GstPushSrc * psrc, GstBuffer ** buf) GST_LOG_OBJECT (src, "create"); if (!src->is_started) { + /* Query and re-validate AOI configuration before starting capture. + * This is required when using AOI with Y offsets. */ + IS_RECT rectAOI; + ret = is_AOI (src->hCam, IS_AOI_IMAGE_GET_AOI, (void *) &rectAOI, + sizeof (rectAOI)); + if (ret == IS_SUCCESS) { + ret = is_AOI (src->hCam, IS_AOI_IMAGE_SET_AOI, (void *) &rectAOI, + sizeof (rectAOI)); + } + ret = is_CaptureVideo (src->hCam, IS_DONT_WAIT); if (ret != IS_SUCCESS) { GST_ELEMENT_ERROR (src, STREAM, WRONG_TYPE, - ("Failed to start video capture"), (NULL)); + ("Failed to start video capture: %s", gst_idsueyesrc_get_error_string (src, ret)), (NULL)); return GST_FLOW_ERROR; }