mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-30 06:46:49 -04:00
spa: varlink: Set a default read timeout for sync calls
Makes sure we don't end up blocking forever, and timeouts are treated as errors.
This commit is contained in:
parent
7fb515d3ee
commit
4f798754e5
4 changed files with 17 additions and 11 deletions
|
|
@ -22,6 +22,8 @@
|
|||
#define METHOD_WRITE_MUTE_VALUE VOLUME_CONTROL_BASE "WriteMuteValue"
|
||||
#define METHOD_WRITE_MUTE_TOGGLE VOLUME_CONTROL_BASE "WriteMuteToggle"
|
||||
|
||||
#define DEFAULT_TIMEOUT_MSEC 500
|
||||
|
||||
static void client_disconnect(void *userdata)
|
||||
{
|
||||
/* TODO: reconnect? bail? */
|
||||
|
|
@ -78,7 +80,8 @@ spa_acp_ext_volume_init(struct spa_acp_ext_volume *ext_volume, struct spa_varlin
|
|||
|
||||
spa_json_builder_close(¶ms_json);
|
||||
|
||||
res = spa_varlink_client_call_sync(ext_volume->client, METHOD_GET_CAPABILITIES, params, &reply);
|
||||
/* Initial probe for capabilities might take a bit longer than the default timeout */
|
||||
res = spa_varlink_client_call_sync(ext_volume->client, METHOD_GET_CAPABILITIES, params, &reply, 2000);
|
||||
|
||||
if (res < 0) {
|
||||
pa_log_error("Failed to query volume control capabilities: %s", spa_strerror(res));
|
||||
|
|
@ -164,7 +167,7 @@ spa_acp_ext_volume_read_volume(struct spa_acp_ext_volume *ext_volume,
|
|||
|
||||
spa_json_builder_close(¶ms_json);
|
||||
|
||||
res = spa_varlink_client_call_sync(ext_volume->client, METHOD_READ_VOLUME, params, &reply);
|
||||
res = spa_varlink_client_call_sync(ext_volume->client, METHOD_READ_VOLUME, params, &reply, DEFAULT_TIMEOUT_MSEC);
|
||||
|
||||
if (res < 0) {
|
||||
pa_log_error("Failed to query volume : %s", spa_strerror(res));
|
||||
|
|
@ -311,7 +314,7 @@ spa_acp_ext_volume_read_mute(struct spa_acp_ext_volume *ext_volume,
|
|||
|
||||
spa_json_builder_close(¶ms_json);
|
||||
|
||||
res = spa_varlink_client_call_sync(ext_volume->client, METHOD_READ_MUTE, params, &reply);
|
||||
res = spa_varlink_client_call_sync(ext_volume->client, METHOD_READ_MUTE, params, &reply, DEFAULT_TIMEOUT_MSEC);
|
||||
|
||||
if (res < 0) {
|
||||
pa_log_error("Failed to query mute state: %s", spa_strerror(res));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue