From 78f16bc04b9444a88e69ac52d2c918d9b2e08761 Mon Sep 17 00:00:00 2001 From: Mengshi Wu Date: Mon, 19 Jan 2026 15:15:26 +0800 Subject: [PATCH] bluez5: Remove hw-offload feature flag check and associated quirks The sco_offload_btcodec() function now returns void and only skips offload setup when using the default datapath, simplifying the logic and removing the need for explicit feature flag checks. --- spa/plugins/bluez5/backend-native.c | 11 +++++------ spa/plugins/bluez5/defs.h | 1 - spa/plugins/bluez5/quirks.c | 6 ------ 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/spa/plugins/bluez5/backend-native.c b/spa/plugins/bluez5/backend-native.c index 312618081..e5bd5eb1c 100644 --- a/spa/plugins/bluez5/backend-native.c +++ b/spa/plugins/bluez5/backend-native.c @@ -298,12 +298,15 @@ static const struct media_codec *codec_list_best(struct impl *backend, struct sp return NULL; } -static int sco_offload_btcodec(struct impl *backend, int sock, bool msbc) +static void sco_offload_btcodec(struct impl *backend, int sock, bool msbc) { int err; char buffer[255]; struct bt_codecs *codecs; + if (backend->hfphsp_sco_datapath == HFP_SCO_DEFAULT_DATAPATH) + return; + spa_log_info(backend->log, "sock(%d) msbc(%d)", sock, msbc); memset(buffer, 0, sizeof(buffer)); @@ -321,7 +324,6 @@ static int sco_offload_btcodec(struct impl *backend, int sock, bool msbc) spa_log_error(backend->log, "ERROR: %s (%d)", strerror(errno), errno); else spa_log_info(backend->log, "set offload codec succeeded"); - return err; } static DBusHandlerResult profile_release(DBusConnection *conn, DBusMessage *m, void *userdata) @@ -2623,10 +2625,7 @@ static int sco_create_socket(struct impl *backend, struct spa_bt_adapter *adapte } } - if (backend->quirks && - (spa_bt_quirks_get_features(backend->quirks, NULL, NULL, &bt_features) == 0) && - ((bt_features & (SPA_BT_FEATURE_HW_OFFLOAD)) != 0)) - sco_offload_btcodec(backend, sock, transparent); + sco_offload_btcodec(backend, sock, transparent); return spa_steal_fd(sock); } diff --git a/spa/plugins/bluez5/defs.h b/spa/plugins/bluez5/defs.h index 4bc4fa3bb..afc56c920 100644 --- a/spa/plugins/bluez5/defs.h +++ b/spa/plugins/bluez5/defs.h @@ -810,7 +810,6 @@ enum spa_bt_feature { SPA_BT_FEATURE_SBC_XQ = (1 << 5), SPA_BT_FEATURE_FASTSTREAM = (1 << 6), SPA_BT_FEATURE_A2DP_DUPLEX = (1 << 7), - SPA_BT_FEATURE_HW_OFFLOAD = (1 << 8), }; struct spa_bt_quirks; diff --git a/spa/plugins/bluez5/quirks.c b/spa/plugins/bluez5/quirks.c index 2a1c5e860..c4b293e68 100644 --- a/spa/plugins/bluez5/quirks.c +++ b/spa/plugins/bluez5/quirks.c @@ -52,7 +52,6 @@ struct spa_bt_quirks { int force_sbc_xq; int force_faststream; int force_a2dp_duplex; - int force_hw_offload; char *device_rules; char *adapter_rules; @@ -70,7 +69,6 @@ static enum spa_bt_feature parse_feature(const char *str) { "sbc-xq", SPA_BT_FEATURE_SBC_XQ }, { "faststream", SPA_BT_FEATURE_FASTSTREAM }, { "a2dp-duplex", SPA_BT_FEATURE_A2DP_DUPLEX }, - { "hw-offload", SPA_BT_FEATURE_HW_OFFLOAD }, }; SPA_FOR_EACH_ELEMENT_VAR(feature_keys, f) { if (spa_streq(str, f->key)) @@ -230,7 +228,6 @@ struct spa_bt_quirks *spa_bt_quirks_create(const struct spa_dict *info, struct s this->force_hw_volume = parse_force_flag(info, "bluez5.enable-hw-volume"); this->force_faststream = parse_force_flag(info, "bluez5.enable-faststream"); this->force_a2dp_duplex = parse_force_flag(info, "bluez5.enable-a2dp-duplex"); - this->force_hw_offload = parse_force_flag(info, "bluez5.hw-offload-sco"); if ((str = spa_dict_lookup(info, "bluez5.hardware-database")) != NULL) { spa_log_debug(this->log, "loading session manager provided data"); @@ -388,9 +385,6 @@ static int get_features(const struct spa_bt_quirks *this, if (this->force_a2dp_duplex != -1) SPA_FLAG_UPDATE(*features, SPA_BT_FEATURE_A2DP_DUPLEX, this->force_a2dp_duplex); - if (this->force_hw_offload != -1) - SPA_FLAG_UPDATE(*features, SPA_BT_FEATURE_HW_OFFLOAD, this->force_hw_offload); - return 0; }