mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
v4l2: ensure that the default frame rate is within the min/max bounds
Without this for continuous frame intervals, the default is set to 25 fps even if that is outside the min/max bounds (e.g. defined by the peer). Clip the default with the min/max bound to avoid this.
This commit is contained in:
parent
669f53946e
commit
e76e057038
1 changed files with 13 additions and 2 deletions
|
|
@ -853,8 +853,19 @@ do_frminterval_filter:
|
|||
n_fractions++;
|
||||
} else if (port->frmival.type == V4L2_FRMIVAL_TYPE_CONTINUOUS ||
|
||||
port->frmival.type == V4L2_FRMIVAL_TYPE_STEPWISE) {
|
||||
if (n_fractions == 0)
|
||||
spa_pod_builder_fraction(&b.b, 25, 1);
|
||||
if (n_fractions == 0) {
|
||||
struct spa_fraction f = { 25, 1 };
|
||||
if (compare_fraction(&port->frmival.stepwise.max, &f) > 0) {
|
||||
f.denom = port->frmival.stepwise.max.numerator;
|
||||
f.num = port->frmival.stepwise.max.denominator;
|
||||
}
|
||||
if (compare_fraction(&port->frmival.stepwise.min, &f) < 0) {
|
||||
f.denom = port->frmival.stepwise.min.numerator;
|
||||
f.num = port->frmival.stepwise.min.denominator;
|
||||
}
|
||||
|
||||
spa_pod_builder_fraction(&b.b, f.num, f.denom);
|
||||
}
|
||||
spa_pod_builder_fraction(&b.b,
|
||||
port->frmival.stepwise.max.denominator,
|
||||
port->frmival.stepwise.max.numerator);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue