[pulseaudio-discuss] [PATCH 2/8] null-sink, pipe-sink: prefer thread_info variables in the IO thread
Tanu Kaskinen
tanuk at iki.fi
Mon Feb 19 14:48:20 UTC 2018
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.
---
src/modules/module-null-sink.c | 2 +-
src/modules/module-pipe-sink.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index 25b0f3091..c29722fad 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -91,7 +91,7 @@ static int sink_process_msg(
switch (code) {
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)
u->timestamp = pa_rtclock_now();
}
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index a2074c1f2..fc909af15 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -111,10 +111,10 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
switch (code) {
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)
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) {
/* Clear potential FIFO error flag */
u->fifo_error = false;
--
2.15.1
More information about the pulseaudio-discuss
mailing list