mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-07-21 02:05:38 +00:00
v4l2: handle empty properties gracefully
When a property is not found or is empty, go on to the next format instead of failing. See #3959
This commit is contained in:
parent
51c2b02e9e
commit
61af61a4b3
|
@ -386,9 +386,8 @@ enum_filter_format(uint32_t media_type, int32_t media_subtype,
|
|||
return -ENOENT;
|
||||
|
||||
val = spa_pod_get_values(&p->value, &n_values, &choice);
|
||||
|
||||
if (val->type != SPA_TYPE_Id)
|
||||
return -EINVAL;
|
||||
if (val->type != SPA_TYPE_Id || n_values == 0)
|
||||
return SPA_VIDEO_FORMAT_UNKNOWN;
|
||||
|
||||
values = SPA_POD_BODY(val);
|
||||
|
||||
|
@ -614,7 +613,7 @@ do_enum_fmt:
|
|||
goto do_frmsize;
|
||||
|
||||
val = spa_pod_get_values(&p->value, &n_vals, &choice);
|
||||
if (val->type != SPA_TYPE_Rectangle)
|
||||
if (val->type != SPA_TYPE_Rectangle || n_vals == 0)
|
||||
goto enum_end;
|
||||
|
||||
if (choice == SPA_CHOICE_None) {
|
||||
|
@ -652,7 +651,7 @@ do_enum_fmt:
|
|||
goto have_size;
|
||||
|
||||
val = spa_pod_get_values(&p->value, &n_values, &choice);
|
||||
if (val->type != SPA_TYPE_Rectangle)
|
||||
if (val->type != SPA_TYPE_Rectangle || n_values == 0)
|
||||
goto have_size;
|
||||
|
||||
values = SPA_POD_BODY_CONST(val);
|
||||
|
@ -772,8 +771,7 @@ do_enum_fmt:
|
|||
goto have_framerate;
|
||||
|
||||
val = spa_pod_get_values(&p->value, &n_values, &choice);
|
||||
|
||||
if (val->type != SPA_TYPE_Fraction)
|
||||
if (val->type != SPA_TYPE_Fraction || n_values == 0)
|
||||
goto enum_end;
|
||||
|
||||
values = SPA_POD_BODY(val);
|
||||
|
|
Loading…
Reference in a new issue