static int bt_transport_acquire(struct userdata *u, pa_bool_t start) {
pa_assert(u->transport);
- if (u->transport_acquired) {
- if (start)
- goto done;
+ if (u->transport_acquired)
return 0;
- }
pa_log_debug("Acquiring transport %s", u->transport->path);
u->transport_acquired = true;
pa_log_info("Transport %s acquired: fd %d", u->transport->path, u->stream_fd);
- if (!start)
- return 0;
-
-done:
- /* If thread is still about to start, the stream will be set up in the beginning of thread_func() */
- if (u->thread == NULL)
- return 0;
-
- setup_stream(u);
-
return 0;
}
if (!u->source || !PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
if (bt_transport_acquire(u, TRUE) < 0)
failed = TRUE;
+ else
+ setup_stream(u);
}
break;
if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
if (bt_transport_acquire(u, TRUE) < 0)
failed = TRUE;
+ else
+ setup_stream(u);
}
/* We don't resume the smoother here. Instead we
* wait until the first packet arrives */
return -1;
}
- return bt_transport_acquire(u, TRUE);
+ if (bt_transport_acquire(u, TRUE) < 0)
+ return -1;
+
+ setup_stream(u);
+
+ return 0;
}
if (changed) {