[pulseaudio-discuss] [PATCH v0 07/16] bluetooth: Unlink sink-sources in stop_thread()
Mikel Astiz
mikel.astiz.oss at gmail.com
Fri Sep 28 08:45:31 PDT 2012
From: Mikel Astiz <mikel.astiz at bmw-carit.de>
Avoid duplicated code by moving the unlinking of sinks and sources to
stop_thread(). After all, they need to be unlinked when the thread is
stopped.
---
src/modules/bluetooth/module-bluetooth-device.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 2635e93..ea31fa3 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2036,6 +2036,12 @@ static void stop_thread(struct userdata *u) {
pa_assert(u);
+ if (u->sink && !USE_SCO_OVER_PCM(u))
+ pa_sink_unlink(u->sink);
+
+ if (u->source && !USE_SCO_OVER_PCM(u))
+ pa_source_unlink(u->source);
+
if (u->thread) {
pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL);
pa_thread_free(u->thread);
@@ -2216,20 +2222,12 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
}
}
- if (u->sink) {
+ if (u->sink)
inputs = pa_sink_move_all_start(u->sink, NULL);
- if (!USE_SCO_OVER_PCM(u))
- pa_sink_unlink(u->sink);
- }
-
- if (u->source) {
+ if (u->source)
outputs = pa_source_move_all_start(u->source, NULL);
- if (!USE_SCO_OVER_PCM(u))
- pa_source_unlink(u->source);
- }
-
stop_thread(u);
if (USE_SCO_OVER_PCM(u))
@@ -2683,12 +2681,6 @@ void pa__done(pa_module *m) {
if (!(u = m->userdata))
return;
- if (u->sink && !USE_SCO_OVER_PCM(u))
- pa_sink_unlink(u->sink);
-
- if (u->source && !USE_SCO_OVER_PCM(u))
- pa_source_unlink(u->source);
-
stop_thread(u);
if (USE_SCO_OVER_PCM(u))
--
1.7.11.4
More information about the pulseaudio-discuss
mailing list