[PATCH] gstreamer: Fix critical warning "gst_value_set_int_range_step: assertion 'start < end' failed"

Umang Jain umang.jain at ideasonboard.com
Sat Jun 29 08:29:07 CEST 2024


Hi Hou Qi,

Thank you for the patch.

On 27/06/24 6:52 am, Hou Qi wrote:
> This changes is fixing critical error message
> "gst_value_set_int_range_step: assertion 'start < end' failed" observed
> when building GStreamer caps from a stream configuration whose size
> range holds a single size.
>
> GStreamer range step definition requires distinct min and max values
> definitions, otherwise above error message is output.

Ah, seems legit.
> Libcamera SizeRange instance may define a single size leading to

s/Libcamera/libcamera

s/may define/may return/
> identical min and max values. Add a test to avoid building GStreamer

This can be rephrased better.

Add a conditional check where the min and max of the range are distinct 
during iterating the supported sizes for each pixelformat.

> range step from a single-size SizeRange to avoid such error.
>
> Signed-off-by: Hou Qi <qi.hou at nxp.com>

I can take care of the commit message while applying the patch,


Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
> ---
>   src/gstreamer/gstlibcamera-utils.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index ec4da435..b6672b9f 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -354,7 +354,7 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats)
>   		}
>   
>   		const SizeRange &range = formats.range(pixelformat);
> -		if (range.hStep && range.vStep) {
> +		if (range.hStep && range.vStep && range.min != range.max) {
>   			GstStructure *s = gst_structure_copy(bare_s);
>   			GValue val = G_VALUE_INIT;
>   



More information about the libcamera-devel mailing list