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

Hou Qi qi.hou at nxp.com
Thu Jun 27 03:22:04 CEST 2024


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.

Libcamera SizeRange instance may define a single size leading to
identical min and max values. Add a test to avoid building GStreamer
range step from a single-size SizeRange to avoid such error.

Signed-off-by: Hou Qi <qi.hou at nxp.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;
 
-- 
2.34.1



More information about the libcamera-devel mailing list