/* Run from IO thread */
static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
struct userdata *u = PA_SINK(o)->userdata;
- bool failed = false;
- int r;
pa_assert(u->sink == PA_SINK(o));
pa_assert(u->transport);
/* Resume the device if the source was suspended as well */
if (!u->source || !PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
if (bt_transport_acquire(u, false) < 0)
- failed = true;
+ return -1;
else
setup_stream(u);
}
}
}
- r = pa_sink_process_msg(o, code, data, offset, chunk);
-
- return (r < 0 || !failed) ? r : -1;
+ return pa_sink_process_msg(o, code, data, offset, chunk);
}
/* Run from IO thread */
static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
struct userdata *u = PA_SOURCE(o)->userdata;
- bool failed = false;
- int r;
pa_assert(u->source == PA_SOURCE(o));
pa_assert(u->transport);
/* Resume the device if the sink was suspended as well */
if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
if (bt_transport_acquire(u, false) < 0)
- failed = true;
+ return -1;
else
setup_stream(u);
}
}
- r = pa_source_process_msg(o, code, data, offset, chunk);
-
- return (r < 0 || !failed) ? r : -1;
+ return pa_source_process_msg(o, code, data, offset, chunk);
}
/* Called from main thread context */
/* Run from IO thread */
static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
struct userdata *u = PA_SOURCE(o)->userdata;
- bool failed = false;
- int r;
pa_assert(u->source == PA_SOURCE(o));
pa_assert(u->transport);
break;
/* Resume the device if the sink was suspended as well */
- if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
- failed = !setup_transport_and_stream(u);
+ if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
+ if (!setup_transport_and_stream(u))
+ return -1;
+ }
/* We don't resume the smoother here. Instead we
* wait until the first packet arrives */
}
- r = pa_source_process_msg(o, code, data, offset, chunk);
-
- return (r < 0 || !failed) ? r : -1;
+ return pa_source_process_msg(o, code, data, offset, chunk);
}
/* Run from main thread */
/* Run from IO thread */
static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
struct userdata *u = PA_SINK(o)->userdata;
- bool failed = false;
- int r;
pa_assert(u->sink == PA_SINK(o));
pa_assert(u->transport);
break;
/* Resume the device if the source was suspended as well */
- if (!u->source || !PA_SOURCE_IS_OPENED(u->source->thread_info.state))
- failed = !setup_transport_and_stream(u);
+ if (!u->source || !PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
+ if (!setup_transport_and_stream(u))
+ return -1;
+ }
break;
return 0;
}
- r = pa_sink_process_msg(o, code, data, offset, chunk);
-
- return (r < 0 || !failed) ? r : -1;
+ return pa_sink_process_msg(o, code, data, offset, chunk);
}
/* Run from main thread */