From 14b265f646109f9fd29e180e8ebdb0ac6d3aeeba Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 17 Jan 2024 09:47:32 +0100 Subject: [PATCH] v4l2: fix format enum with unsupported framerate Actually count the number of frame fractions we add. If we added 0, we don't have any supported framerate that intersects with the filter and we try the next frame size. See #1793 --- spa/plugins/v4l2/v4l2-utils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index 8647ca9e3..ea5fb06a0 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -815,6 +815,7 @@ spa_v4l2_enum_format(struct impl *this, int seq, port->frmival.discrete.denominator, port->frmival.discrete.numerator); port->frmival.index++; + n_fractions++; } else if (port->frmival.type == V4L2_FRMIVAL_TYPE_CONTINUOUS || port->frmival.type == V4L2_FRMIVAL_TYPE_STEPWISE) { if (n_fractions == 0) @@ -828,20 +829,23 @@ spa_v4l2_enum_format(struct impl *this, int seq, if (port->frmival.type == V4L2_FRMIVAL_TYPE_CONTINUOUS) { choice->body.type = SPA_CHOICE_Range; + n_fractions += 2; } else { choice->body.type = SPA_CHOICE_Step; spa_pod_builder_fraction(&b, port->frmival.stepwise.step.denominator, port->frmival.stepwise.step.numerator); + n_fractions += 3; } port->frmsize.index++; port->next_frmsize = true; break; } - n_fractions++; } - if (n_fractions <= 1) + if (n_fractions == 0) + goto next_frmsize; + if (n_fractions == 1) choice->body.type = SPA_CHOICE_None; spa_pod_builder_pop(&b, &f[1]);