mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
bluetooth: Release transport in stop_thread()
Avoid duplicated code by releasing the transport inside stop_thread(), along with the rest of the thread-related cleanup.
This commit is contained in:
parent
0c5054e04a
commit
8560b495bd
1 changed files with 6 additions and 18 deletions
|
|
@ -1987,13 +1987,6 @@ static int setup_transport(struct userdata *u) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* release transport if exist */
|
||||
if (u->transport) {
|
||||
bt_transport_release(u);
|
||||
pa_xfree(u->transport);
|
||||
u->transport = NULL;
|
||||
}
|
||||
|
||||
/* check if profile has a transport */
|
||||
t = pa_bluetooth_device_get_transport(d, u->profile);
|
||||
if (t == NULL) {
|
||||
|
|
@ -2066,6 +2059,12 @@ static void stop_thread(struct userdata *u) {
|
|||
u->hsp.nrec_changed_slot = NULL;
|
||||
}
|
||||
|
||||
if (u->transport) {
|
||||
bt_transport_release(u);
|
||||
pa_xfree(u->transport);
|
||||
u->transport = NULL;
|
||||
}
|
||||
|
||||
if (u->sink) {
|
||||
if (u->profile == PROFILE_HSP) {
|
||||
k = pa_sprintf_malloc("bluetooth-device@%p", (void*) u->sink);
|
||||
|
|
@ -2230,12 +2229,6 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
|
|||
|
||||
stop_thread(u);
|
||||
|
||||
if (u->profile != PROFILE_OFF && u->transport) {
|
||||
bt_transport_release(u);
|
||||
pa_xfree(u->transport);
|
||||
u->transport = NULL;
|
||||
}
|
||||
|
||||
if (USE_SCO_OVER_PCM(u))
|
||||
restore_sco_volume_callbacks(u);
|
||||
|
||||
|
|
@ -2740,11 +2733,6 @@ void pa__done(pa_module *m) {
|
|||
pa_xfree(u->address);
|
||||
pa_xfree(u->path);
|
||||
|
||||
if (u->transport) {
|
||||
bt_transport_release(u);
|
||||
pa_xfree(u->transport);
|
||||
}
|
||||
|
||||
if (u->discovery)
|
||||
pa_bluetooth_discovery_unref(u->discovery);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue