sink, source: remove the state getters

pa_sink_get_state() and pa_source_get_state() just return the state
variable. We can as well access the state variable directly.

There are no behaviour changes, except that module-virtual-source
accessed the main thread's sink state variable from its push() callback.
I fixed the module so that it uses the thread_info.state variable
instead. Also, the compiler started to complain about comparing a sink
state variable to a source state enum value in protocol-esound.c. The
underlying bug was that a source pointer was assigned to a variable
whose type was a sink pointer (somehow using the pa_source_get_state()
macro confused the compiler enough so that it didn't complain before).
I fixed the variable type.
This commit is contained in:
Tanu Kaskinen 2018-06-26 16:25:58 +03:00
parent b4a36453da
commit 6665b466d2
26 changed files with 82 additions and 87 deletions

View file

@ -966,18 +966,19 @@ static int esd_proto_standby_or_resume(connection *c, esd_proto_t request, const
static int esd_proto_standby_mode(connection *c, esd_proto_t request, const void *data, size_t length) {
int32_t mode;
pa_sink *sink, *source;
pa_sink *sink;
pa_source *source;
connection_assert_ref(c);
mode = ESM_RUNNING;
if ((sink = pa_namereg_get(c->protocol->core, c->options->default_sink, PA_NAMEREG_SINK)))
if (pa_sink_get_state(sink) == PA_SINK_SUSPENDED)
if (sink->state == PA_SINK_SUSPENDED)
mode = ESM_ON_STANDBY;
if ((source = pa_namereg_get(c->protocol->core, c->options->default_source, PA_NAMEREG_SOURCE)))
if (pa_source_get_state(source) == PA_SOURCE_SUSPENDED)
if (source->state == PA_SOURCE_SUSPENDED)
mode = ESM_ON_STANDBY;
mode = PA_MAYBE_INT32_SWAP(c->swap_byte_order, mode);