mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
jack: handle connect errors
Listen on the proxy for errors and report this to the caller. This avoids hanging in jack_connect.
This commit is contained in:
parent
6444147a12
commit
38bcab4610
1 changed files with 33 additions and 7 deletions
|
|
@ -3852,6 +3852,18 @@ int jack_port_monitoring_input (jack_port_t *port)
|
||||||
return o->port.monitor_requests > 0;
|
return o->port.monitor_requests > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void link_proxy_error(void *data, int seq, int res, const char *message)
|
||||||
|
{
|
||||||
|
int *link_res = data;
|
||||||
|
*link_res = res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct pw_proxy_events link_proxy_events = {
|
||||||
|
PW_VERSION_PROXY_EVENTS,
|
||||||
|
.error = link_proxy_error,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int jack_connect (jack_client_t *client,
|
int jack_connect (jack_client_t *client,
|
||||||
const char *source_port,
|
const char *source_port,
|
||||||
|
|
@ -3862,13 +3874,14 @@ int jack_connect (jack_client_t *client,
|
||||||
struct spa_dict props;
|
struct spa_dict props;
|
||||||
struct spa_dict_item items[6];
|
struct spa_dict_item items[6];
|
||||||
struct pw_proxy *proxy;
|
struct pw_proxy *proxy;
|
||||||
|
struct spa_hook listener;
|
||||||
char val[4][16];
|
char val[4][16];
|
||||||
const char *str;
|
const char *str;
|
||||||
int res;
|
int res, link_res = 0;
|
||||||
|
|
||||||
spa_return_val_if_fail(c != NULL, -EINVAL);
|
spa_return_val_if_fail(c != NULL, EINVAL);
|
||||||
spa_return_val_if_fail(source_port != NULL, -EINVAL);
|
spa_return_val_if_fail(source_port != NULL, EINVAL);
|
||||||
spa_return_val_if_fail(destination_port != NULL, -EINVAL);
|
spa_return_val_if_fail(destination_port != NULL, EINVAL);
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: connect %s %s", client, source_port, destination_port);
|
pw_log_debug(NAME" %p: connect %s %s", client, source_port, destination_port);
|
||||||
|
|
||||||
|
|
@ -3906,14 +3919,27 @@ int jack_connect (jack_client_t *client,
|
||||||
PW_VERSION_LINK,
|
PW_VERSION_LINK,
|
||||||
&props,
|
&props,
|
||||||
0);
|
0);
|
||||||
|
if (proxy == NULL) {
|
||||||
|
res = -errno;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
spa_zero(listener);
|
||||||
|
pw_proxy_add_listener(proxy, &listener, &link_proxy_events, &link_res);
|
||||||
|
|
||||||
res = do_sync(c);
|
res = do_sync(c);
|
||||||
|
|
||||||
|
spa_hook_remove(&listener);
|
||||||
|
|
||||||
|
if (link_res < 0)
|
||||||
|
res = link_res;
|
||||||
|
|
||||||
pw_proxy_destroy(proxy);
|
pw_proxy_destroy(proxy);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
pw_thread_loop_unlock(c->context.loop);
|
pw_thread_loop_unlock(c->context.loop);
|
||||||
|
|
||||||
return res;
|
return -res;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
@ -3957,7 +3983,7 @@ int jack_disconnect (jack_client_t *client,
|
||||||
exit:
|
exit:
|
||||||
pw_thread_loop_unlock(c->context.loop);
|
pw_thread_loop_unlock(c->context.loop);
|
||||||
|
|
||||||
return res;
|
return -res;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
@ -3985,7 +4011,7 @@ int jack_port_disconnect (jack_client_t *client, jack_port_t *port)
|
||||||
|
|
||||||
pw_thread_loop_unlock(c->context.loop);
|
pw_thread_loop_unlock(c->context.loop);
|
||||||
|
|
||||||
return res;
|
return -res;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue