mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
bluez5: minor error handling etc. fixups
This commit is contained in:
parent
44f10330e8
commit
18dde01d87
3 changed files with 15 additions and 4 deletions
|
|
@ -4052,6 +4052,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
this->a2dp_codecs = NULL;
|
this->a2dp_codecs = NULL;
|
||||||
this->quirks = NULL;
|
this->quirks = NULL;
|
||||||
|
this->conn = NULL;
|
||||||
this->dbus_connection = NULL;
|
this->dbus_connection = NULL;
|
||||||
|
|
||||||
this->a2dp_codecs = load_a2dp_codecs(this->plugin_loader, this->log);
|
this->a2dp_codecs = load_a2dp_codecs(this->plugin_loader, this->log);
|
||||||
|
|
@ -4139,10 +4140,13 @@ fail:
|
||||||
free_a2dp_codecs(this->a2dp_codecs);
|
free_a2dp_codecs(this->a2dp_codecs);
|
||||||
if (this->quirks)
|
if (this->quirks)
|
||||||
spa_bt_quirks_destroy(this->quirks);
|
spa_bt_quirks_destroy(this->quirks);
|
||||||
|
if (this->conn)
|
||||||
|
dbus_connection_unref(this->conn);
|
||||||
if (this->dbus_connection)
|
if (this->dbus_connection)
|
||||||
spa_dbus_connection_destroy(this->dbus_connection);
|
spa_dbus_connection_destroy(this->dbus_connection);
|
||||||
this->a2dp_codecs = NULL;
|
this->a2dp_codecs = NULL;
|
||||||
this->quirks = NULL;
|
this->quirks = NULL;
|
||||||
|
this->conn = NULL;
|
||||||
this->dbus_connection = NULL;
|
this->dbus_connection = NULL;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ static int codec_order_cmp(const void *a, const void *b)
|
||||||
|
|
||||||
static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name)
|
static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name)
|
||||||
{
|
{
|
||||||
struct spa_handle *handle;
|
struct spa_handle *handle = NULL;
|
||||||
void *iface;
|
void *iface;
|
||||||
const struct spa_bluez5_codec_a2dp *bluez5_codec_a2dp;
|
const struct spa_bluez5_codec_a2dp *bluez5_codec_a2dp;
|
||||||
int n_codecs = 0;
|
int n_codecs = 0;
|
||||||
|
|
@ -97,7 +97,7 @@ static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name)
|
||||||
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Bluez5CodecA2DP, &iface)) < 0) {
|
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Bluez5CodecA2DP, &iface)) < 0) {
|
||||||
spa_log_info(impl->log, NAME ": Bluetooth codec plugin %s has no codec interface",
|
spa_log_info(impl->log, NAME ": Bluetooth codec plugin %s has no codec interface",
|
||||||
factory_name);
|
factory_name);
|
||||||
return res;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
bluez5_codec_a2dp = iface;
|
bluez5_codec_a2dp = iface;
|
||||||
|
|
@ -105,7 +105,8 @@ static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name)
|
||||||
if (bluez5_codec_a2dp->iface.version != SPA_VERSION_BLUEZ5_CODEC_A2DP) {
|
if (bluez5_codec_a2dp->iface.version != SPA_VERSION_BLUEZ5_CODEC_A2DP) {
|
||||||
spa_log_info(impl->log, NAME ": codec plugin %s has incompatible ABI version (%d != %d)",
|
spa_log_info(impl->log, NAME ": codec plugin %s has incompatible ABI version (%d != %d)",
|
||||||
factory_name, bluez5_codec_a2dp->iface.version, SPA_VERSION_BLUEZ5_CODEC_A2DP);
|
factory_name, bluez5_codec_a2dp->iface.version, SPA_VERSION_BLUEZ5_CODEC_A2DP);
|
||||||
return -ENOENT;
|
res = -ENOENT;
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; bluez5_codec_a2dp->codecs[i]; ++i) {
|
for (i = 0; bluez5_codec_a2dp->codecs[i]; ++i) {
|
||||||
|
|
@ -141,6 +142,11 @@ static int load_a2dp_codecs_from(struct impl *impl, const char *factory_name)
|
||||||
spa_plugin_loader_unload(impl->loader, handle);
|
spa_plugin_loader_unload(impl->loader, handle);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
if (handle)
|
||||||
|
spa_plugin_loader_unload(impl->loader, handle);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct a2dp_codec * const *load_a2dp_codecs(struct spa_plugin_loader *loader, struct spa_log *log)
|
const struct a2dp_codec * const *load_a2dp_codecs(struct spa_plugin_loader *loader, struct spa_log *log)
|
||||||
|
|
|
||||||
|
|
@ -713,7 +713,8 @@ static void emit_node_info(struct impl *this, bool full)
|
||||||
{ "media.name", ((this->transport && this->transport->device->name) ?
|
{ "media.name", ((this->transport && this->transport->device->name) ?
|
||||||
this->transport->device->name : "HSP/HFP") },
|
this->transport->device->name : "HSP/HFP") },
|
||||||
};
|
};
|
||||||
bool is_ag = (this->transport->profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY);
|
bool is_ag = this->transport &&
|
||||||
|
(this->transport->profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY);
|
||||||
uint64_t old = full ? this->info.change_mask : 0;
|
uint64_t old = full ? this->info.change_mask : 0;
|
||||||
|
|
||||||
if (full)
|
if (full)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue