summaryrefslogtreecommitdiffstats
path: root/binding/radio-binding.c
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-12-19 09:37:28 -0500
committerScott Murray <scott.murray@konsulko.com>2019-12-19 10:07:40 -0500
commitc7d5a53e76514e90a9a555ac72b9e61c0f2171e6 (patch)
treeaa6870e3425e43c0d3daffa56a68b7fd8a456410 /binding/radio-binding.c
parent174b63ed864873c197c30831ee029d211c490034 (diff)
Fixes: - Track playing state in binding code to properly ignore signal-composer events when not playing. - Add changing of pipeline state in response to the GstBus GST_MESSAGE_REQUEST_STATE message to the KF code, this is required to have the second request to switch back to PLAYING state be sent, and hence properly keeping track of corked state. Also added required gstreamer main loop so GstBus actually works. - The alsasrc used in the KF code's gstreamer pipeline seems to not handle the switch to READY state on pause (currently required to trigger Wireplumber policy) as expected; it seems to keep feeding the pipeline, causing long stalls on restart. For now, taking the stream fully down to NULL state seems to work around this issue. Bug-AGL: SPEC-3061, SPEC-3046 Change-Id: I7d4493e3475a67a5e18065982673b5cd145c4773 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'binding/radio-binding.c')
-rw-r--r--binding/radio-binding.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/binding/radio-binding.c b/binding/radio-binding.c
index 0de45a6..61798eb 100644
--- a/binding/radio-binding.c
+++ b/binding/radio-binding.c
@@ -36,6 +36,8 @@ static afb_event_t freq_event;
static afb_event_t scan_event;
static afb_event_t status_event;
+static bool playing;
+
static const char *signalcomposer_events[] = {
"event.media.next",
"event.media.previous",
@@ -316,6 +318,7 @@ static void start(afb_req_t request)
{
radio_impl_ops->set_output(NULL);
radio_impl_ops->start();
+ playing = true;
afb_req_success(request, NULL, NULL);
json_object *jresp = json_object_new_object();
@@ -333,6 +336,7 @@ static void start(afb_req_t request)
static void stop(afb_req_t request)
{
radio_impl_ops->stop();
+ playing = false;
afb_req_success(request, NULL, NULL);
json_object *jresp = json_object_new_object();
@@ -522,9 +526,11 @@ static void onevent(afb_api_t api, const char *event, struct json_object *object
if (strncmp(uid, "event.media.", 12))
return;
- if (radio_impl_ops->get_corking_state &&
- radio_impl_ops->get_corking_state())
+ if (!playing ||
+ (radio_impl_ops->get_corking_state &&
+ radio_impl_ops->get_corking_state())) {
return;
+ }
json_object_object_get_ex(object, "value", &tmp);
if (tmp == NULL)