mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04: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->quirks = NULL;
|
||||
this->conn = NULL;
|
||||
this->dbus_connection = NULL;
|
||||
|
||||
this->a2dp_codecs = load_a2dp_codecs(this->plugin_loader, this->log);
|
||||
|
|
@ -4139,10 +4140,13 @@ fail:
|
|||
free_a2dp_codecs(this->a2dp_codecs);
|
||||
if (this->quirks)
|
||||
spa_bt_quirks_destroy(this->quirks);
|
||||
if (this->conn)
|
||||
dbus_connection_unref(this->conn);
|
||||
if (this->dbus_connection)
|
||||
spa_dbus_connection_destroy(this->dbus_connection);
|
||||
this->a2dp_codecs = NULL;
|
||||
this->quirks = NULL;
|
||||
this->conn = NULL;
|
||||
this->dbus_connection = NULL;
|
||||
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)
|
||||
{
|
||||
struct spa_handle *handle;
|
||||
struct spa_handle *handle = NULL;
|
||||
void *iface;
|
||||
const struct spa_bluez5_codec_a2dp *bluez5_codec_a2dp;
|
||||
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) {
|
||||
spa_log_info(impl->log, NAME ": Bluetooth codec plugin %s has no codec interface",
|
||||
factory_name);
|
||||
return res;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
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) {
|
||||
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);
|
||||
return -ENOENT;
|
||||
res = -ENOENT;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -713,7 +713,8 @@ static void emit_node_info(struct impl *this, bool full)
|
|||
{ "media.name", ((this->transport && this->transport->device->name) ?
|
||||
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;
|
||||
|
||||
if (full)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue