mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
null-sink, pipe-sink: some state variable cleanups
pa_sink_get_state() is supposed to be used from the main thread. In this case it doesn't really matter, because the SET_STATE handler is executed while the main thread is waiting, but since the state is available also in thread_info, let's use that. All other modules use thread_info.state too, so at least this change improves consistency. Also, we can use the PA_SINK_IS_OPENED macro to simplify the code a bit.
This commit is contained in:
parent
2dff0d6a6a
commit
7f09164ed7
2 changed files with 5 additions and 5 deletions
|
|
@ -91,8 +91,8 @@ static int sink_process_msg(
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case PA_SINK_MESSAGE_SET_STATE:
|
case PA_SINK_MESSAGE_SET_STATE:
|
||||||
|
|
||||||
if (pa_sink_get_state(u->sink) == PA_SINK_SUSPENDED || pa_sink_get_state(u->sink) == PA_SINK_INIT) {
|
if (u->sink->thread_info.state == PA_SINK_SUSPENDED || u->sink->thread_info.state == PA_SINK_INIT) {
|
||||||
if (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING || PA_PTR_TO_UINT(data) == PA_SINK_IDLE)
|
if (PA_SINK_IS_OPENED(PA_PTR_TO_UINT(data)))
|
||||||
u->timestamp = pa_rtclock_now();
|
u->timestamp = pa_rtclock_now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,10 +111,10 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case PA_SINK_MESSAGE_SET_STATE:
|
case PA_SINK_MESSAGE_SET_STATE:
|
||||||
if (pa_sink_get_state(u->sink) == PA_SINK_SUSPENDED || pa_sink_get_state(u->sink) == PA_SINK_INIT) {
|
if (u->sink->thread_info.state == PA_SINK_SUSPENDED || u->sink->thread_info.state == PA_SINK_INIT) {
|
||||||
if (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING || PA_PTR_TO_UINT(data) == PA_SINK_IDLE)
|
if (PA_SINK_IS_OPENED(PA_PTR_TO_UINT(data)))
|
||||||
u->timestamp = pa_rtclock_now();
|
u->timestamp = pa_rtclock_now();
|
||||||
} else if (pa_sink_get_state(u->sink) == PA_SINK_RUNNING || pa_sink_get_state(u->sink) == PA_SINK_IDLE) {
|
} else if (u->sink->thread_info.state == PA_SINK_RUNNING || u->sink->thread_info.state == PA_SINK_IDLE) {
|
||||||
if (PA_PTR_TO_UINT(data) == PA_SINK_SUSPENDED) {
|
if (PA_PTR_TO_UINT(data) == PA_SINK_SUSPENDED) {
|
||||||
/* Clear potential FIFO error flag */
|
/* Clear potential FIFO error flag */
|
||||||
u->fifo_error = false;
|
u->fifo_error = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue