module-session-manager: use dynamic builder

The buffer is very small and we should use a dynamic builder if we don't
know what pod we will expect.
This commit is contained in:
Wim Taymans 2023-06-15 11:05:17 +02:00
parent bbf8f1a0c8
commit 0b2d9ee007
8 changed files with 88 additions and 80 deletions

View file

@ -10,6 +10,7 @@
#include <spa/utils/result.h>
#include <spa/pod/builder.h>
#include <spa/pod/filter.h>
#include <spa/pod/dynamic.h>
#define MAX_PARAMS 32
@ -84,8 +85,8 @@ static int method_enum_params(void *object, int seq,
struct param_data *pdata;
struct spa_pod *result;
struct spa_pod *param;
uint8_t buffer[1024];
struct spa_pod_builder b = { 0 };
uint8_t buffer[2048];
struct spa_pod_dynamic_builder b = { 0 };
uint32_t index;
uint32_t next = start;
uint32_t count = 0;
@ -103,15 +104,15 @@ static int method_enum_params(void *object, int seq,
param = *pw_array_get_unchecked(&pdata->params, index, struct spa_pod*);
spa_pod_builder_init(&b, buffer, sizeof(buffer));
if (spa_pod_filter(&b, &result, param, filter) != 0)
continue;
spa_pod_dynamic_builder_init(&b, buffer, sizeof(buffer), 4096);
if (spa_pod_filter(&b.b, &result, param, filter) == 0) {
pw_log_debug(NAME" %p: %d param %u", impl, seq, index);
pw_endpoint_stream_resource_param(d->resource, seq, id, index, next, result);
count++;
}
spa_pod_dynamic_builder_clean(&b);
pw_log_debug(NAME" %p: %d param %u", impl, seq, index);
pw_endpoint_stream_resource_param(d->resource, seq, id, index, next, result);
if (++count == num)
if (count == num)
return 0;
}
}