Thread (3 messages) flat view 3 messages, 3 authors, 2021-07-21

Re: [PATCH BlueZ] [BlueZ] audio/a2dp: refcount

From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2021-07-21 17:03:12

Hi Sébastien,

On Wed, Jul 21, 2021 at 2:29 AM Sébastien Viande [off-list ref] wrote:
Fix a2dp setup.

I'm not the initial author of the code you can find the source on
https://patches.linaro.org/patch/285268/
If you read the comments we actually made some different changes to
address that, are you still having similar issues even with those
changes? It maybe some configuration not working, so perhaps you can
describe the problem or better yet create a github issue with the
logs.
quoted hunk ↗ jump to hunk
This patch fix my problem the a2dp source not available there was only
HSP/HFP.
---
 profiles/audio/a2dp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 86bc02994..be707edda 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1568,6 +1568,8 @@ static void channel_free(void *data)
        }

        avdtp_remove_state_cb(chan->state_id);
+       if (chan->session)
+               avdtp_unref(chan->session);

        queue_destroy(chan->seps, remove_remote_sep);
        free(chan->last_used);
@@ -2149,7 +2151,7 @@ static void avdtp_state_cb(struct btd_device *dev, struct avdtp *session,
                break;
        case AVDTP_SESSION_STATE_CONNECTED:
                if (!chan->session)
-                       chan->session = session;
+                       chan->session = avdtp_ref(session);
                load_remote_seps(chan);
                break;
        }
@@ -2229,6 +2231,7 @@ found:
                channel_remove(chan);
                return NULL;
        }
+       avdtp_ref(chan->session);

        return avdtp_ref(chan->session);
 }
@@ -2249,6 +2252,7 @@ static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
                        error("Unable to create AVDTP session");
                        goto fail;
                }
+               avdtp_ref(chan->session);
        }

        g_io_channel_unref(chan->io);
--
2.32.0

-- 
Luiz Augusto von Dentz
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help