mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
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:
parent
8560b495bd
commit
fcaef8285a
1 changed files with 8 additions and 16 deletions
|
|
@ -2033,6 +2033,12 @@ static void stop_thread(struct userdata *u) {
|
||||||
|
|
||||||
pa_assert(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) {
|
if (u->thread) {
|
||||||
pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL);
|
pa_asyncmsgq_send(u->thread_mq.inq, NULL, PA_MESSAGE_SHUTDOWN, NULL, 0, NULL);
|
||||||
pa_thread_free(u->thread);
|
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);
|
inputs = pa_sink_move_all_start(u->sink, NULL);
|
||||||
|
|
||||||
if (!USE_SCO_OVER_PCM(u))
|
if (u->source)
|
||||||
pa_sink_unlink(u->sink);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (u->source) {
|
|
||||||
outputs = pa_source_move_all_start(u->source, NULL);
|
outputs = pa_source_move_all_start(u->source, NULL);
|
||||||
|
|
||||||
if (!USE_SCO_OVER_PCM(u))
|
|
||||||
pa_source_unlink(u->source);
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_thread(u);
|
stop_thread(u);
|
||||||
|
|
||||||
if (USE_SCO_OVER_PCM(u))
|
if (USE_SCO_OVER_PCM(u))
|
||||||
|
|
@ -2680,12 +2678,6 @@ void pa__done(pa_module *m) {
|
||||||
if (!(u = m->userdata))
|
if (!(u = m->userdata))
|
||||||
return;
|
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);
|
stop_thread(u);
|
||||||
|
|
||||||
if (USE_SCO_OVER_PCM(u))
|
if (USE_SCO_OVER_PCM(u))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue