[PATCH] gstreamer: Fix critical warning "gst_value_set_int_range_step: assertion 'start < end' failed"
Olivier Crête
olivier.crete at collabora.com
Thu Jul 4 18:04:17 CEST 2024
Hi,
On Thu, 2024-06-27 at 10:22 +0900, Hou Qi wrote:
> --- 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;
What if range.min.width == range.max.widht, but range.min.height !=
range.max.height ?
I think a more foolproof implementation is:
g_value_init(&val, GST_TYPE_INT_RANGE);
if (range.min.width == range.max.width) {
gst_structure_set_int (s, "width", G_TYPE_INT, range.min.width);
} else {
gst_value_set_int_range_step(&val, range.min.width, range.max.width, range.hStep);
gst_structure_set_value(s, "width", &val);
}
if (range.min.height == range.max.height) {
gst_structure_set_int (s, "height", G_TYPE_INT, range.min.height);
} else {
gst_value_set_int_range_step(&val, range.min.height, range.max.height, range.vStep);
gst_structure_set_value(s, "height", &val);
}
gst_caps_merge_structure(caps, s); // Using merge to avoid duplicating existing structures from size)
--
Olivier Crête
olivier.crete at collabora.com
Multimedia Lead
More information about the libcamera-devel
mailing list