mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
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:
parent
b4a36453da
commit
6665b466d2
26 changed files with 82 additions and 87 deletions
|
|
@ -146,8 +146,8 @@ static const pa_echo_canceller ec_table[] = {
|
|||
#define MAX_LATENCY_BLOCKS 10
|
||||
|
||||
/* Can only be used in main context */
|
||||
#define IS_ACTIVE(u) ((pa_source_get_state((u)->source) == PA_SOURCE_RUNNING) && \
|
||||
(pa_sink_get_state((u)->sink) == PA_SINK_RUNNING))
|
||||
#define IS_ACTIVE(u) (((u)->source->state == PA_SOURCE_RUNNING) && \
|
||||
((u)->sink->state == PA_SINK_RUNNING))
|
||||
|
||||
/* This module creates a new (virtual) source and sink.
|
||||
*
|
||||
|
|
@ -476,7 +476,7 @@ static int source_set_state_in_main_thread_cb(pa_source *s, pa_source_state_t st
|
|||
|
||||
if (state == PA_SOURCE_RUNNING) {
|
||||
/* restart timer when both sink and source are active */
|
||||
if ((pa_sink_get_state(u->sink) == PA_SINK_RUNNING) && u->adjust_time)
|
||||
if ((u->sink->state == PA_SINK_RUNNING) && u->adjust_time)
|
||||
pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time);
|
||||
|
||||
pa_atomic_store(&u->request_resync, 1);
|
||||
|
|
@ -501,7 +501,7 @@ static int sink_set_state_in_main_thread_cb(pa_sink *s, pa_sink_state_t state, p
|
|||
|
||||
if (state == PA_SINK_RUNNING) {
|
||||
/* restart timer when both sink and source are active */
|
||||
if ((pa_source_get_state(u->source) == PA_SOURCE_RUNNING) && u->adjust_time)
|
||||
if ((u->source->state == PA_SOURCE_RUNNING) && u->adjust_time)
|
||||
pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time);
|
||||
|
||||
pa_atomic_store(&u->request_resync, 1);
|
||||
|
|
@ -597,7 +597,7 @@ static void source_set_volume_cb(pa_source *s) {
|
|||
pa_source_assert_ref(s);
|
||||
pa_assert_se(u = s->userdata);
|
||||
|
||||
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s)) ||
|
||||
if (!PA_SOURCE_IS_LINKED(s->state) ||
|
||||
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state))
|
||||
return;
|
||||
|
||||
|
|
@ -611,7 +611,7 @@ static void sink_set_volume_cb(pa_sink *s) {
|
|||
pa_sink_assert_ref(s);
|
||||
pa_assert_se(u = s->userdata);
|
||||
|
||||
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) ||
|
||||
if (!PA_SINK_IS_LINKED(s->state) ||
|
||||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
|
||||
return;
|
||||
|
||||
|
|
@ -626,7 +626,7 @@ static void source_get_volume_cb(pa_source *s) {
|
|||
pa_source_assert_ref(s);
|
||||
pa_assert_se(u = s->userdata);
|
||||
|
||||
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s)) ||
|
||||
if (!PA_SOURCE_IS_LINKED(s->state) ||
|
||||
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state))
|
||||
return;
|
||||
|
||||
|
|
@ -647,7 +647,7 @@ static void source_set_mute_cb(pa_source *s) {
|
|||
pa_source_assert_ref(s);
|
||||
pa_assert_se(u = s->userdata);
|
||||
|
||||
if (!PA_SOURCE_IS_LINKED(pa_source_get_state(s)) ||
|
||||
if (!PA_SOURCE_IS_LINKED(s->state) ||
|
||||
!PA_SOURCE_OUTPUT_IS_LINKED(u->source_output->state))
|
||||
return;
|
||||
|
||||
|
|
@ -661,7 +661,7 @@ static void sink_set_mute_cb(pa_sink *s) {
|
|||
pa_sink_assert_ref(s);
|
||||
pa_assert_se(u = s->userdata);
|
||||
|
||||
if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)) ||
|
||||
if (!PA_SINK_IS_LINKED(s->state) ||
|
||||
!PA_SINK_INPUT_IS_LINKED(u->sink_input->state))
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue