mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-08 13:30:08 -05:00
tests: fix clang build
This commit is contained in:
parent
ac90a0db13
commit
41dd96426c
1 changed files with 33 additions and 24 deletions
|
|
@ -219,30 +219,39 @@ static void test_properties(void)
|
|||
pw_main_loop_destroy(loop);
|
||||
}
|
||||
|
||||
struct roundtrip_data
|
||||
{
|
||||
struct pw_main_loop *loop;
|
||||
int pending;
|
||||
int done;
|
||||
};
|
||||
|
||||
static void core_event_done(void *object, uint32_t id, int seq)
|
||||
{
|
||||
struct roundtrip_data *data = object;
|
||||
if (id == PW_ID_CORE && seq == data->pending) {
|
||||
data->done = 1;
|
||||
printf("done %d\n", seq);
|
||||
pw_main_loop_quit(data->loop);
|
||||
}
|
||||
}
|
||||
|
||||
static int roundtrip(struct pw_core *core, struct pw_main_loop *loop)
|
||||
{
|
||||
struct spa_hook core_listener;
|
||||
int pending, done = 0;
|
||||
void core_event_done(void *object, uint32_t id, int seq) {
|
||||
if (id == PW_ID_CORE && seq == pending) {
|
||||
done = 1;
|
||||
printf("done %d\n", seq);
|
||||
pw_main_loop_quit(loop);
|
||||
}
|
||||
}
|
||||
struct roundtrip_data data = { .loop = loop };
|
||||
const struct pw_core_events core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.done = core_event_done,
|
||||
};
|
||||
|
||||
spa_zero(core_listener);
|
||||
pw_core_add_listener(core, &core_listener,
|
||||
&core_events, NULL);
|
||||
&core_events, &data);
|
||||
|
||||
pending = pw_core_sync(core, PW_ID_CORE, 0);
|
||||
printf("sync %d\n", pending);
|
||||
data.pending = pw_core_sync(core, PW_ID_CORE, 0);
|
||||
printf("sync %d\n", data.pending);
|
||||
|
||||
while (!done) {
|
||||
while (!data.done) {
|
||||
pw_main_loop_run(loop);
|
||||
}
|
||||
spa_hook_remove(&core_listener);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue