From 7e6bb05390c4ffb0a8a4764361a48b36946dfeae Mon Sep 17 00:00:00 2001 From: ckdo Date: Tue, 29 Oct 2019 08:52:25 +0100 Subject: [PATCH] raop: Code clarification : Detect raop_client recording state in a proper way --- src/modules/raop/raop-client.c | 4 ++++ src/modules/raop/raop-client.h | 1 + src/modules/raop/raop-sink.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/raop/raop-client.c b/src/modules/raop/raop-client.c index e4dc9ea..5d45302 100644 --- a/src/modules/raop/raop-client.c +++ b/src/modules/raop/raop-client.c @@ -1565,6 +1565,10 @@ bool pa_raop_client_can_stream(pa_raop_client *c) { return false; } +bool pa_raop_client_is_recording(pa_raop_client *c) { + return c->is_recording; +} + int pa_raop_client_stream(pa_raop_client *c) { int rv = 0; diff --git a/src/modules/raop/raop-client.h b/src/modules/raop/raop-client.h index 72e6018..e72459e 100644 --- a/src/modules/raop/raop-client.h +++ b/src/modules/raop/raop-client.h @@ -65,6 +65,7 @@ bool pa_raop_client_is_authenticated(pa_raop_client *c); int pa_raop_client_announce(pa_raop_client *c); bool pa_raop_client_is_alive(pa_raop_client *c); +bool pa_raop_client_is_recording(pa_raop_client *c); bool pa_raop_client_can_stream(pa_raop_client *c); int pa_raop_client_stream(pa_raop_client *c); int pa_raop_client_set_volume(pa_raop_client *c, pa_volume_t volume); diff --git a/src/modules/raop/raop-sink.c b/src/modules/raop/raop-sink.c index 09e8958..84840cc 100644 --- a/src/modules/raop/raop-sink.c +++ b/src/modules/raop/raop-sink.c @@ -268,7 +268,7 @@ static int sink_set_state_in_io_thread_cb(pa_sink *s, pa_sink_state_t new_state, if (!pa_raop_client_is_alive(u->raop)) { /* Connecting will trigger a RECORD and start steaming */ pa_raop_client_announce(u->raop); - } else if (!pa_raop_client_can_stream(u->raop)) { + } else if (!pa_raop_client_is_recording(u->raop)) { /* RECORD alredy sent, simply start streaming */ pa_raop_client_stream(u->raop); pa_rtpoll_set_timer_absolute(u->rtpoll, now); -- 2.7.4