diff options
author | Wim Taymans <wtaymans@redhat.com> | 2020-06-09 13:22:07 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2020-06-09 13:22:07 +0200 |
commit | 014e48c1f1c47404653f597e500314cbf021056d (patch) | |
tree | 5a98c02dab04d0698519462d23e2c9e7f020d5f7 | |
parent | 62dd58a6049d1b41895aa21917ef46ae5e8aac0b (diff) |
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.
-rw-r--r-- | src/modules/module-protocol-native/v0/protocol-native.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); |