Skip to content

Commit

Permalink
Keep D-Bus client PCM and RFCOMM in separate files
Browse files Browse the repository at this point in the history
This commit does not change logic, it only moves things around. Also, it
unifies function names used in the dbus-client-* components.
  • Loading branch information
arkq committed Dec 28, 2023
1 parent bcc21e2 commit 4645def
Show file tree
Hide file tree
Showing 26 changed files with 1,350 additions and 1,244 deletions.
2 changes: 2 additions & 0 deletions src/asound/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ asound_module_conf_DATA = 20-bluealsa.conf
libasound_module_ctl_bluealsa_la_SOURCES = \
../shared/a2dp-codecs.c \
../shared/dbus-client.c \
../shared/dbus-client-pcm.c \
bluealsa-ctl.c
libasound_module_pcm_bluealsa_la_SOURCES = \
../shared/a2dp-codecs.c \
../shared/dbus-client.c \
../shared/dbus-client-pcm.c \
../shared/hex.c \
../shared/log.c \
../shared/rt.c \
Expand Down
49 changes: 25 additions & 24 deletions src/asound/bluealsa-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <dbus/dbus.h>

#include "shared/dbus-client.h"
#include "shared/dbus-client-pcm.h"
#include "shared/defs.h"

#define DELAY_SYNC_STEP 250
Expand Down Expand Up @@ -301,7 +302,7 @@ static int bluealsa_pcm_fetch_codecs(struct bluealsa_ctl *ctl, struct ba_pcm *pc
* already removed by the BlueALSA server. It will happen when server
* removes PCM but ALSA control plug-in was not yet able to process
* elem remove event. */
bluealsa_dbus_pcm_get_codecs(&ctl->dbus_ctx, pcm->pcm_path, codecs, NULL);
ba_dbus_pcm_codecs_get(&ctl->dbus_ctx, pcm->pcm_path, codecs, NULL);

/* If the list of codecs could not be fetched, return currently
* selected codec as the only one. This will at least allow the
Expand Down Expand Up @@ -871,15 +872,15 @@ static int bluealsa_create_elem_list(struct bluealsa_ctl *ctl) {
static void bluealsa_free_elem_list(struct bluealsa_ctl *ctl) {
for (size_t i = 0; i < ctl->elem_list_size; i++)
if (ctl->elem_list[i].type == CTL_ELEM_TYPE_CODEC)
bluealsa_dbus_pcm_codecs_free(&ctl->elem_list[i].codecs);
ba_dbus_pcm_codecs_free(&ctl->elem_list[i].codecs);
}

static void bluealsa_close(snd_ctl_ext_t *ext) {

struct bluealsa_ctl *ctl = (struct bluealsa_ctl *)ext->private_data;
size_t i;

bluealsa_dbus_connection_ctx_free(&ctl->dbus_ctx);
ba_dbus_connection_ctx_free(&ctl->dbus_ctx);
bluealsa_free_elem_list(ctl);

if (ctl->pipefd[0] != -1)
Expand Down Expand Up @@ -1104,7 +1105,7 @@ static int bluealsa_write_integer(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, lon
if (pcm->volume.raw == old)
return 0;

if (!bluealsa_dbus_pcm_update(&ctl->dbus_ctx, pcm, BLUEALSA_PCM_VOLUME, NULL))
if (!ba_dbus_pcm_update(&ctl->dbus_ctx, pcm, BLUEALSA_PCM_VOLUME, NULL))
return -ENOMEM;

return 1;
Expand Down Expand Up @@ -1255,7 +1256,7 @@ static int bluealsa_write_enumerated(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
return -EINVAL;
if (strcmp(pcm->codec.name, elem->codecs.codecs[items[0]].name) == 0)
return 0;
if (!bluealsa_dbus_pcm_select_codec(&ctl->dbus_ctx, pcm->pcm_path,
if (!ba_dbus_pcm_select_codec(&ctl->dbus_ctx, pcm->pcm_path,
elem->codecs.codecs[items[0]].name, NULL, 0, NULL))
return -EIO;
process_events(&ctl->ext);
Expand All @@ -1267,7 +1268,7 @@ static int bluealsa_write_enumerated(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
if (pcm->soft_volume == soft_volume)
return 0;
pcm->soft_volume = soft_volume;
if (!bluealsa_dbus_pcm_update(&ctl->dbus_ctx, pcm, BLUEALSA_PCM_SOFT_VOLUME, NULL))
if (!ba_dbus_pcm_update(&ctl->dbus_ctx, pcm, BLUEALSA_PCM_SOFT_VOLUME, NULL))
return -ENOMEM;
break;
case CTL_ELEM_TYPE_DELAY_SYNC:
Expand All @@ -1276,7 +1277,7 @@ static int bluealsa_write_enumerated(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
const int16_t delay_adjustment = items[0] * DELAY_SYNC_STEP + DELAY_SYNC_MIN_VALUE;
if (pcm->delay_adjustment == delay_adjustment)
return 0;
if (!bluealsa_dbus_pcm_set_delay_adjustment(&ctl->dbus_ctx, pcm->pcm_path,
if (!ba_dbus_pcm_set_delay_adjustment(&ctl->dbus_ctx, pcm->pcm_path,
pcm->codec.name, delay_adjustment, NULL))
return -EIO;
process_events(&ctl->ext);
Expand All @@ -1294,23 +1295,23 @@ static void bluealsa_subscribe_events(snd_ctl_ext_t *ext, int subscribe) {
struct bluealsa_ctl *ctl = (struct bluealsa_ctl *)ext->private_data;

if (subscribe) {
bluealsa_dbus_connection_signal_match_add(&ctl->dbus_ctx, ctl->dbus_ctx.ba_service, NULL,
ba_dbus_connection_signal_match_add(&ctl->dbus_ctx, ctl->dbus_ctx.ba_service, NULL,
DBUS_INTERFACE_OBJECT_MANAGER, "InterfacesAdded", "path_namespace='/org/bluealsa'");
bluealsa_dbus_connection_signal_match_add(&ctl->dbus_ctx, ctl->dbus_ctx.ba_service, NULL,
ba_dbus_connection_signal_match_add(&ctl->dbus_ctx, ctl->dbus_ctx.ba_service, NULL,
DBUS_INTERFACE_OBJECT_MANAGER, "InterfacesRemoved", "path_namespace='/org/bluealsa'");
char dbus_args[50];
snprintf(dbus_args, sizeof(dbus_args), "arg0='%s',arg2=''", ctl->dbus_ctx.ba_service);
bluealsa_dbus_connection_signal_match_add(&ctl->dbus_ctx, DBUS_SERVICE_DBUS, NULL,
ba_dbus_connection_signal_match_add(&ctl->dbus_ctx, DBUS_SERVICE_DBUS, NULL,
DBUS_INTERFACE_DBUS, "NameOwnerChanged", dbus_args);
bluealsa_dbus_connection_signal_match_add(&ctl->dbus_ctx, ctl->dbus_ctx.ba_service, NULL,
ba_dbus_connection_signal_match_add(&ctl->dbus_ctx, ctl->dbus_ctx.ba_service, NULL,
DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", "arg0='"BLUEALSA_INTERFACE_PCM"'");
bluealsa_dbus_connection_signal_match_add(&ctl->dbus_ctx, ctl->dbus_ctx.ba_service, NULL,
ba_dbus_connection_signal_match_add(&ctl->dbus_ctx, ctl->dbus_ctx.ba_service, NULL,
DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", "arg0='"BLUEALSA_INTERFACE_RFCOMM"'");
bluealsa_dbus_connection_signal_match_add(&ctl->dbus_ctx, "org.bluez", NULL,
ba_dbus_connection_signal_match_add(&ctl->dbus_ctx, "org.bluez", NULL,
DBUS_INTERFACE_PROPERTIES, "PropertiesChanged", "arg0='org.bluez.Device1'");
}
else
bluealsa_dbus_connection_signal_match_clean(&ctl->dbus_ctx);
ba_dbus_connection_signal_match_clean(&ctl->dbus_ctx);

dbus_connection_flush(ctl->dbus_ctx.conn);
}
Expand Down Expand Up @@ -1382,7 +1383,7 @@ static DBusHandlerResult bluealsa_dbus_msg_filter(DBusConnection *conn,
for (i = 0; i < ctl->elem_list_size; i++) {
struct bt_dev *dev = ctl->elem_list[i].dev;
if (strcmp(dev->device_path, path) == 0) {
bluealsa_dbus_message_iter_dict(&iter, NULL,
dbus_message_iter_dict(&iter, NULL,
bluealsa_dbus_msg_update_dev, dev);
if (dev->mask & BT_DEV_MASK_UPDATE)
goto remove_add;
Expand All @@ -1403,7 +1404,7 @@ static DBusHandlerResult bluealsa_dbus_msg_filter(DBusConnection *conn,
struct ctl_elem *elem = &ctl->elem_list[i];
struct bt_dev *dev = elem->dev;
if (strcmp(dev->rfcomm_path, path) == 0) {
bluealsa_dbus_message_iter_dict(&iter, NULL,
dbus_message_iter_dict(&iter, NULL,
bluealsa_dbus_msg_update_dev, dev);
/* for non-dynamic mode we need to use update logic */
if (ctl->dynamic &&
Expand All @@ -1424,7 +1425,7 @@ static DBusHandlerResult bluealsa_dbus_msg_filter(DBusConnection *conn,
if (elem->type == CTL_ELEM_TYPE_BATTERY)
continue;
if (strcmp(pcm->pcm_path, path) == 0) {
bluealsa_dbus_message_iter_get_pcm_props(&iter, NULL, pcm);
dbus_message_iter_get_ba_pcm_props(&iter, NULL, pcm);
bluealsa_event_elem_updated(ctl, elem);
}
}
Expand All @@ -1434,7 +1435,7 @@ static DBusHandlerResult bluealsa_dbus_msg_filter(DBusConnection *conn,

if (strcmp(signal, "InterfacesAdded") == 0) {
struct ba_pcm pcm;
if (bluealsa_dbus_message_iter_get_pcm(&iter, NULL, &pcm) &&
if (dbus_message_iter_get_ba_pcm(&iter, NULL, &pcm) &&
pcm.transport != BA_PCM_TRANSPORT_NONE) {

if (ctl->dynamic)
Expand Down Expand Up @@ -1557,7 +1558,7 @@ static int bluealsa_read_event(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsign
* ourself and receive required event flags. If someday ALSA will be so
* kind to actually call .poll_revents(), this code should remain as a
* backward compatibility. */
bluealsa_dbus_connection_dispatch(&ctl->dbus_ctx);
ba_dbus_connection_dispatch(&ctl->dbus_ctx);
/* For the same reason, we also need to clear any internal ping events. */
if (ctl->single_device)
bluealsa_pipefd_flush(ctl);
Expand All @@ -1571,7 +1572,7 @@ static int bluealsa_poll_descriptors_count(snd_ctl_ext_t *ext) {
struct bluealsa_ctl *ctl = ext->private_data;

nfds_t nfds = 0;
bluealsa_dbus_connection_poll_fds(&ctl->dbus_ctx, NULL, &nfds);
ba_dbus_connection_poll_fds(&ctl->dbus_ctx, NULL, &nfds);

if (ctl->pipefd[0] > -1)
++nfds;
Expand Down Expand Up @@ -1606,7 +1607,7 @@ static int bluealsa_poll_descriptors(snd_ctl_ext_t *ext, struct pollfd *pfd,
}

nfds_t dbus_nfds = nfds - pipe_nfds;
if (!bluealsa_dbus_connection_poll_fds(&ctl->dbus_ctx, &pfd[pipe_nfds], &dbus_nfds))
if (!ba_dbus_connection_poll_fds(&ctl->dbus_ctx, &pfd[pipe_nfds], &dbus_nfds))
return -EINVAL;

return pipe_nfds + dbus_nfds;
Expand All @@ -1631,7 +1632,7 @@ static int bluealsa_poll_revents(snd_ctl_ext_t *ext, struct pollfd *pfd,
pipe_nfds++;
}

if (bluealsa_dbus_connection_poll_dispatch(&ctl->dbus_ctx, &pfd[pipe_nfds], nfds - pipe_nfds))
if (ba_dbus_connection_poll_dispatch(&ctl->dbus_ctx, &pfd[pipe_nfds], nfds - pipe_nfds))
*revents |= POLLIN;

return 0;
Expand Down Expand Up @@ -1847,7 +1848,7 @@ SND_CTL_PLUGIN_DEFINE_FUNC(bluealsa) {

dbus_threads_init_default();

if (!bluealsa_dbus_connection_ctx_init(&ctl->dbus_ctx, service, &err)) {
if (!ba_dbus_connection_ctx_init(&ctl->dbus_ctx, service, &err)) {
SNDERR("Couldn't initialize D-Bus context: %s", err.message);
ret = -ENOMEM;
goto fail;
Expand All @@ -1859,7 +1860,7 @@ SND_CTL_PLUGIN_DEFINE_FUNC(bluealsa) {
goto fail;
}

if (!bluealsa_dbus_get_pcms(&ctl->dbus_ctx, &pcm_list, &pcm_list_size, &err)) {
if (!ba_dbus_pcm_get_all(&ctl->dbus_ctx, &pcm_list, &pcm_list_size, &err)) {
SNDERR("Couldn't get BlueALSA PCM list: %s", err.message);
ret = -ENODEV;
goto fail;
Expand Down
41 changes: 21 additions & 20 deletions src/asound/bluealsa-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <dbus/dbus.h>

#include "shared/dbus-client.h"
#include "shared/dbus-client-pcm.h"
#include "shared/defs.h"
#include "shared/hex.h"
#include "shared/log.h"
Expand Down Expand Up @@ -393,7 +394,7 @@ static int bluealsa_start(snd_pcm_ioplug_t *io) {
return 0;
}

if (!bluealsa_dbus_pcm_ctrl_send_resume(pcm->ba_pcm_ctrl_fd, NULL)) {
if (!ba_dbus_pcm_ctrl_send_resume(pcm->ba_pcm_ctrl_fd, NULL)) {
debug2("Couldn't start PCM: %s", strerror(errno));
return -EIO;
}
Expand Down Expand Up @@ -431,7 +432,7 @@ static int bluealsa_stop(snd_pcm_ioplug_t *io) {
* was stopped. */
pcm->io_hw_ptr = 0;

if (!bluealsa_dbus_pcm_ctrl_send_drop(pcm->ba_pcm_ctrl_fd, NULL))
if (!ba_dbus_pcm_ctrl_send_drop(pcm->ba_pcm_ctrl_fd, NULL))
return -EIO;

/* Applications that call poll() after snd_pcm_drain() will be blocked
Expand Down Expand Up @@ -467,7 +468,7 @@ static snd_pcm_sframes_t bluealsa_pointer(snd_pcm_ioplug_t *io) {
static int bluealsa_close(snd_pcm_ioplug_t *io) {
struct bluealsa_pcm *pcm = io->private_data;
debug2("Closing");
bluealsa_dbus_connection_ctx_free(&pcm->dbus_ctx);
ba_dbus_connection_ctx_free(&pcm->dbus_ctx);
close(pcm->event_fd);
pthread_mutex_destroy(&pcm->mutex);
pthread_cond_destroy(&pcm->pause_cond);
Expand Down Expand Up @@ -573,7 +574,7 @@ static int bluealsa_hw_params(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params)
pcm->frame_size = (snd_pcm_format_physical_width(io->format) * io->channels) / 8;

DBusError err = DBUS_ERROR_INIT;
if (!bluealsa_dbus_pcm_open(&pcm->dbus_ctx, pcm->ba_pcm.pcm_path,
if (!ba_dbus_pcm_open(&pcm->dbus_ctx, pcm->ba_pcm.pcm_path,
&pcm->ba_pcm_fd, &pcm->ba_pcm_ctrl_fd, &err)) {
debug2("Couldn't open PCM: %s", err.message);
dbus_error_free(&err);
Expand Down Expand Up @@ -768,7 +769,7 @@ static int bluealsa_drain(snd_pcm_ioplug_t *io) {
}

if (io->state == SND_PCM_STATE_DRAINING && !aborted)
if (!bluealsa_dbus_pcm_ctrl_send_drain(pcm->ba_pcm_ctrl_fd, NULL)) {
if (!ba_dbus_pcm_ctrl_send_drain(pcm->ba_pcm_ctrl_fd, NULL)) {
bluealsa_stop(io);
io->state = SND_PCM_STATE_SETUP;
ret = -EIO;
Expand Down Expand Up @@ -804,7 +805,7 @@ static snd_pcm_sframes_t bluealsa_calculate_delay(snd_pcm_ioplug_t *io) {
* dispatching was done more than one second ago - this should prioritize
* asynchronous dispatching in the poll_revents() callback. */
if (pcm->dbus_dispatch_ts.tv_sec + 1 < now.tv_sec) {
bluealsa_dbus_connection_dispatch(&pcm->dbus_ctx);
ba_dbus_connection_dispatch(&pcm->dbus_ctx);
gettimestamp(&pcm->dbus_dispatch_ts);
}

Expand Down Expand Up @@ -897,7 +898,7 @@ static int bluealsa_pause(snd_pcm_ioplug_t *io, int enable) {
return -ENODEV;
}

if (!bluealsa_dbus_pcm_ctrl_send(pcm->ba_pcm_ctrl_fd,
if (!ba_dbus_pcm_ctrl_send(pcm->ba_pcm_ctrl_fd,
enable ? "Pause" : "Resume", 200, NULL))
return -EIO;

Expand Down Expand Up @@ -967,7 +968,7 @@ static int bluealsa_poll_descriptors_count(snd_pcm_ioplug_t *io) {
struct bluealsa_pcm *pcm = io->private_data;

nfds_t dbus_nfds = 0;
bluealsa_dbus_connection_poll_fds(&pcm->dbus_ctx, NULL, &dbus_nfds);
ba_dbus_connection_poll_fds(&pcm->dbus_ctx, NULL, &dbus_nfds);

return 1 + dbus_nfds;
}
Expand All @@ -980,7 +981,7 @@ static int bluealsa_poll_descriptors(snd_pcm_ioplug_t *io, struct pollfd *pfd,
return -EINVAL;

nfds_t dbus_nfds = nfds - 1;
if (!bluealsa_dbus_connection_poll_fds(&pcm->dbus_ctx, &pfd[1], &dbus_nfds))
if (!ba_dbus_connection_poll_fds(&pcm->dbus_ctx, &pfd[1], &dbus_nfds))
return -EINVAL;

/* PCM plug-in relies on our internal event file descriptor. */
Expand All @@ -1000,7 +1001,7 @@ static int bluealsa_poll_revents(snd_pcm_ioplug_t *io, struct pollfd *pfd,
if (nfds < 1)
return -EINVAL;

bluealsa_dbus_connection_poll_dispatch(&pcm->dbus_ctx, &pfd[1], nfds - 1);
ba_dbus_connection_poll_dispatch(&pcm->dbus_ctx, &pfd[1], nfds - 1);
while (dbus_connection_dispatch(pcm->dbus_ctx.conn) == DBUS_DISPATCH_DATA_REMAINS)
continue;
gettimestamp(&pcm->dbus_dispatch_ts);
Expand Down Expand Up @@ -1200,7 +1201,7 @@ static DBusHandlerResult bluealsa_dbus_msg_filter(DBusConnection *conn,
dbus_message_iter_next(&iter);

if (strcmp(updated_interface, BLUEALSA_INTERFACE_PCM) == 0)
bluealsa_dbus_message_iter_get_pcm_props(&iter, NULL, &pcm->ba_pcm);
dbus_message_iter_get_ba_pcm_props(&iter, NULL, &pcm->ba_pcm);

return DBUS_HANDLER_RESULT_HANDLED;
}
Expand Down Expand Up @@ -1286,8 +1287,8 @@ static bool bluealsa_select_pcm_codec(struct bluealsa_pcm *pcm, const char *code

}

if (!bluealsa_dbus_pcm_select_codec(&pcm->dbus_ctx, pcm->ba_pcm.pcm_path,
bluealsa_dbus_pcm_get_codec_canonical_name(codec_name), config, config_len, err))
if (!ba_dbus_pcm_select_codec(&pcm->dbus_ctx, pcm->ba_pcm.pcm_path,
ba_dbus_pcm_codec_get_canonical_name(codec_name), config, config_len, err))
goto fail;

ret = true;
Expand All @@ -1314,15 +1315,15 @@ static bool bluealsa_update_pcm_volume(struct bluealsa_pcm *pcm,
}
if (pcm->ba_pcm.volume.raw == old)
return true;
return bluealsa_dbus_pcm_update(&pcm->dbus_ctx, &pcm->ba_pcm, BLUEALSA_PCM_VOLUME, err);
return ba_dbus_pcm_update(&pcm->dbus_ctx, &pcm->ba_pcm, BLUEALSA_PCM_VOLUME, err);
}

static bool bluealsa_update_pcm_softvol(struct bluealsa_pcm *pcm,
int softvol, DBusError *err) {
if (softvol < 0 || !!softvol == pcm->ba_pcm.soft_volume)
return true;
pcm->ba_pcm.soft_volume = !!softvol;
return bluealsa_dbus_pcm_update(&pcm->dbus_ctx, &pcm->ba_pcm, BLUEALSA_PCM_SOFT_VOLUME, err);
return ba_dbus_pcm_update(&pcm->dbus_ctx, &pcm->ba_pcm, BLUEALSA_PCM_SOFT_VOLUME, err);
}

SND_PCM_PLUGIN_DEFINE_FUNC(bluealsa) {
Expand Down Expand Up @@ -1450,7 +1451,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(bluealsa) {
dbus_threads_init_default();

DBusError err = DBUS_ERROR_INIT;
if (bluealsa_dbus_connection_ctx_init(&pcm->dbus_ctx, service, &err) != TRUE) {
if (ba_dbus_connection_ctx_init(&pcm->dbus_ctx, service, &err) != TRUE) {
SNDERR("Couldn't initialize D-Bus context: %s", err.message);
ret = -ENOMEM;
goto fail;
Expand All @@ -1463,7 +1464,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(bluealsa) {
}

debug("Getting BlueALSA PCM: %s %s %s", snd_pcm_stream_name(stream), device, profile);
if (!bluealsa_dbus_get_pcm(&pcm->dbus_ctx, &ba_addr, ba_profile,
if (!ba_dbus_pcm_get(&pcm->dbus_ctx, &ba_addr, ba_profile,
stream == SND_PCM_STREAM_PLAYBACK ? BA_PCM_MODE_SINK : BA_PCM_MODE_SOURCE,
&pcm->ba_pcm, &err)) {
SNDERR("Couldn't get BlueALSA PCM: %s", err.message);
Expand All @@ -1472,7 +1473,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(bluealsa) {
}

/* Subscribe for properties-changed signals but for the opened PCM only. */
bluealsa_dbus_connection_signal_match_add(&pcm->dbus_ctx, pcm->dbus_ctx.ba_service,
ba_dbus_connection_signal_match_add(&pcm->dbus_ctx, pcm->dbus_ctx.ba_service,
pcm->ba_pcm.pcm_path, DBUS_INTERFACE_PROPERTIES, "PropertiesChanged",
"arg0='"BLUEALSA_INTERFACE_PCM"'");

Expand All @@ -1495,7 +1496,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(bluealsa) {
if (bluealsa_select_pcm_codec(pcm, codec, &err)) {
/* Changing the codec may change the audio format, sampling rate and/or
* channels. We need to refresh our cache of PCM properties. */
if (!bluealsa_dbus_get_pcm(&pcm->dbus_ctx, &ba_addr, ba_profile,
if (!ba_dbus_pcm_get(&pcm->dbus_ctx, &ba_addr, ba_profile,
stream == SND_PCM_STREAM_PLAYBACK ? BA_PCM_MODE_SINK : BA_PCM_MODE_SOURCE,
&pcm->ba_pcm, &err)) {
SNDERR("Couldn't get BlueALSA PCM: %s", err.message);
Expand Down Expand Up @@ -1544,7 +1545,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(bluealsa) {
return 0;

fail:
bluealsa_dbus_connection_ctx_free(&pcm->dbus_ctx);
ba_dbus_connection_ctx_free(&pcm->dbus_ctx);
dbus_error_free(&err);
if (pcm->event_fd != -1)
close(pcm->event_fd);
Expand Down
Loading

0 comments on commit 4645def

Please sign in to comment.