From 8c42e6aecb2462dc0fb28f0fe7f4561a69bb8b39 Mon Sep 17 00:00:00 2001 From: Huang-Huang Bao Date: Sat, 5 Jun 2021 02:21:10 +0800 Subject: [PATCH] alsa,bluez5: handle SPA_PARAM_Latency in port_set_param Simply return 0 instead of -ENOENT. Fixes #1262 --- spa/plugins/alsa/alsa-pcm-sink.c | 16 ++++++++++++---- spa/plugins/alsa/alsa-pcm-source.c | 4 +++- spa/plugins/alsa/alsa-seq-bridge.c | 4 +++- spa/plugins/bluez5/a2dp-sink.c | 3 +++ spa/plugins/bluez5/a2dp-source.c | 3 +++ spa/plugins/bluez5/sco-sink.c | 3 +++ spa/plugins/bluez5/sco-source.c | 3 +++ 7 files changed, 30 insertions(+), 6 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm-sink.c b/spa/plugins/alsa/alsa-pcm-sink.c index 6ae0dadf4..03dfd9d0b 100644 --- a/spa/plugins/alsa/alsa-pcm-sink.c +++ b/spa/plugins/alsa/alsa-pcm-sink.c @@ -553,16 +553,24 @@ impl_node_port_set_param(void *object, const struct spa_pod *param) { struct state *this = object; + int res; spa_return_val_if_fail(this != NULL, -EINVAL); spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL); - if (id == SPA_PARAM_Format) { - return port_set_format(this, direction, port_id, flags, param); + switch (id) { + case SPA_PARAM_Format: + res = port_set_format(this, direction, port_id, flags, param); + break; + case SPA_PARAM_Latency: + res = 0; + break; + default: + res = -ENOENT; + break; } - else - return -ENOENT; + return res; } static int diff --git a/spa/plugins/alsa/alsa-pcm-source.c b/spa/plugins/alsa/alsa-pcm-source.c index 5dcb95c00..4504ab9e5 100644 --- a/spa/plugins/alsa/alsa-pcm-source.c +++ b/spa/plugins/alsa/alsa-pcm-source.c @@ -560,7 +560,9 @@ impl_node_port_set_param(void *object, case SPA_PARAM_Format: res = port_set_format(this, direction, port_id, flags, param); break; - + case SPA_PARAM_Latency: + res = 0; + break; default: res = -ENOENT; break; diff --git a/spa/plugins/alsa/alsa-seq-bridge.c b/spa/plugins/alsa/alsa-seq-bridge.c index 5280e5619..0ae77fb51 100644 --- a/spa/plugins/alsa/alsa-seq-bridge.c +++ b/spa/plugins/alsa/alsa-seq-bridge.c @@ -677,7 +677,9 @@ impl_node_port_set_param(void *object, case SPA_PARAM_Format: res = port_set_format(this, port, flags, param); break; - + case SPA_PARAM_Latency: + res = 0; + break; default: res = -ENOENT; break; diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index be6b7efac..10adb8212 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -1208,6 +1208,9 @@ impl_node_port_set_param(void *object, case SPA_PARAM_Format: res = port_set_format(this, port, flags, param); break; + case SPA_PARAM_Latency: + res = 0; + break; default: res = -ENOENT; break; diff --git a/spa/plugins/bluez5/a2dp-source.c b/spa/plugins/bluez5/a2dp-source.c index 2934899fd..46ad23e46 100644 --- a/spa/plugins/bluez5/a2dp-source.c +++ b/spa/plugins/bluez5/a2dp-source.c @@ -1072,6 +1072,9 @@ impl_node_port_set_param(void *object, case SPA_PARAM_Format: res = port_set_format(this, port, flags, param); break; + case SPA_PARAM_Latency: + res = 0; + break; default: res = -ENOENT; break; diff --git a/spa/plugins/bluez5/sco-sink.c b/spa/plugins/bluez5/sco-sink.c index 3594523d9..f7cfe6a3e 100644 --- a/spa/plugins/bluez5/sco-sink.c +++ b/spa/plugins/bluez5/sco-sink.c @@ -998,6 +998,9 @@ impl_node_port_set_param(void *object, case SPA_PARAM_Format: res = port_set_format(this, port, flags, param); break; + case SPA_PARAM_Latency: + res = 0; + break; default: res = -ENOENT; break; diff --git a/spa/plugins/bluez5/sco-source.c b/spa/plugins/bluez5/sco-source.c index 03d87f97c..99a406aa7 100644 --- a/spa/plugins/bluez5/sco-source.c +++ b/spa/plugins/bluez5/sco-source.c @@ -1034,6 +1034,9 @@ impl_node_port_set_param(void *object, case SPA_PARAM_Format: res = port_set_format(this, port, flags, param); break; + case SPA_PARAM_Latency: + res = 0; + break; default: res = -ENOENT; break;