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

@ -714,7 +714,7 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
/* Uncork the sink input unless the destination is suspended for other
* reasons than idle. */
if (pa_source_get_state(dest) == PA_SOURCE_SUSPENDED)
if (dest->state == PA_SOURCE_SUSPENDED)
pa_sink_input_cork(u->sink_input, (dest->suspend_cause != PA_SUSPEND_IDLE));
else
pa_sink_input_cork(u->sink_input, false);
@ -1098,7 +1098,7 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
/* Uncork the source output unless the destination is suspended for other
* reasons than idle */
if (pa_sink_get_state(dest) == PA_SINK_SUSPENDED)
if (dest->state == PA_SINK_SUSPENDED)
pa_source_output_cork(u->source_output, (dest->suspend_cause != PA_SUSPEND_IDLE));
else
pa_source_output_cork(u->source_output, false);
@ -1565,10 +1565,10 @@ int pa__init(pa_module *m) {
pa_sink_input_put(u->sink_input);
pa_source_output_put(u->source_output);
if (pa_source_get_state(u->source_output->source) != PA_SOURCE_SUSPENDED)
if (u->source_output->source->state != PA_SOURCE_SUSPENDED)
pa_sink_input_cork(u->sink_input, false);
if (pa_sink_get_state(u->sink_input->sink) != PA_SINK_SUSPENDED)
if (u->sink_input->sink->state != PA_SINK_SUSPENDED)
pa_source_output_cork(u->source_output, false);
update_adjust_timer(u);