From 014e48c1f1c47404653f597e500314cbf021056d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 9 Jun 2020 13:22:07 +0200 Subject: protocol: add workaround for bad v0 clients Fix up clients that say they have fixed properties while in fact they are not. Assume that when there are alternatives, the property was in fact not fixed. --- src/modules/module-protocol-native/v0/protocol-native.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/module-protocol-native/v0/protocol-native.c b/src/modules/module-protocol-native/v0/protocol-native.c index 76b8f450..dc0eb59a 100644 --- a/src/modules/module-protocol-native/v0/protocol-native.c +++ b/src/modules/module-protocol-native/v0/protocol-native.c @@ -406,6 +406,8 @@ struct spa_pod_prop_body0 { (iter) <= SPA_MEMBER((body), (_size)-(body)->value.size, __typeof__(*iter)); \ (iter) = SPA_MEMBER((iter), (body)->value.size, __typeof__(*iter))) +#define SPA0_POD_PROP_N_VALUES(b,size) ((size - sizeof(struct spa_pod_prop_body0)) / (b)->value.size) + static int remap_from_v2(uint32_t type, void *body, uint32_t size, struct pw_impl_client *client, struct spa_pod_builder *builder) { @@ -445,7 +447,8 @@ static int remap_from_v2(uint32_t type, void *body, uint32_t size, struct pw_imp type = SPA_CHOICE_Flags; break; } - if (!SPA_FLAG_IS_SET(b->flags, SPA_POD_PROP0_FLAG_UNSET)) + if (!SPA_FLAG_IS_SET(b->flags, SPA_POD_PROP0_FLAG_UNSET) && + SPA0_POD_PROP_N_VALUES(b, size) == 1) type = SPA_CHOICE_None; spa_pod_builder_push_choice(builder, &f, type, 0); -- cgit v1.2.3