bluetooth: Unlink sink-sources in stop_thread()

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.
This commit is contained in:
Mikel Astiz 2012-09-28 17:45:31 +02:00 committed by Tanu Kaskinen
parent 8560b495bd
commit fcaef8285a

View file

@ -2033,6 +2033,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);
@ -2213,20 +2219,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))
@ -2680,12 +2678,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))