diff options
author | Wim Taymans <wtaymans@redhat.com> | 2019-06-26 07:23:34 -0400 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2019-06-26 07:23:34 -0400 |
commit | bee88e52795aeb8d1ba846a0f9d59f61678921d2 (patch) | |
tree | 1595a09df37d2a0be719081575f4ae9414aac2c2 | |
parent | 891c5fd79dbac27d4a674a9b68f708d867ea7635 (diff) |
v4l2: handle and recover from control failure
When we fail to construct the labels of a control, reset and
continue without labels.
-rw-r--r-- | spa/plugins/v4l2/v4l2-utils.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/spa/plugins/v4l2/v4l2-utils.c b/spa/plugins/v4l2/v4l2-utils.c index 5196ae00..166dac45 100644 --- a/spa/plugins/v4l2/v4l2-utils.c +++ b/spa/plugins/v4l2/v4l2-utils.c @@ -1107,6 +1107,7 @@ spa_v4l2_enum_controls(struct impl *this, int seq, case V4L2_CTRL_TYPE_MENU: { struct v4l2_querymenu querymenu; + struct spa_pod_builder_state state; spa_pod_builder_push_object(&b, &f[0], SPA_TYPE_OBJECT_PropInfo, SPA_PARAM_PropInfo); spa_pod_builder_add(&b, @@ -1119,6 +1120,8 @@ spa_v4l2_enum_controls(struct impl *this, int seq, querymenu.id = queryctrl.id; spa_pod_builder_prop(&b, SPA_PROP_INFO_labels, 0); + + spa_pod_builder_get_state(&b, &state); spa_pod_builder_push_struct(&b, &f[1]); for (querymenu.index = queryctrl.minimum; querymenu.index <= queryctrl.maximum; @@ -1128,11 +1131,13 @@ spa_v4l2_enum_controls(struct impl *this, int seq, spa_pod_builder_string(&b, (const char *)querymenu.name); } } - spa_pod_builder_pop(&b, &f[1]); - param = spa_pod_builder_pop(&b, &f[0]); - if (param == NULL) + if (spa_pod_builder_pop(&b, &f[1]) == NULL) { spa_log_warn(this->log, "can't create Control '%s' overflow %d", queryctrl.name, b.state.offset); + spa_pod_builder_reset(&b, &state); + spa_pod_builder_none(&b); + } + param = spa_pod_builder_pop(&b, &f[0]); break; } case V4L2_CTRL_TYPE_INTEGER_MENU: |