summaryrefslogtreecommitdiffstats
path: root/binding/radio_impl_kingfisher.c
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-12-16 19:59:25 -0500
committerScott Murray <scott.murray@konsulko.com>2019-12-16 20:10:53 -0500
commitd9045cbf0768cb743adf4123c2ca36710d73ed05 (patch)
treea91a95714389285e833ae2dc7d2d255b900a49a9 /binding/radio_impl_kingfisher.c
parent77b59fd16b1506803aec40c9999fc9890bae83d2 (diff)
Add workaround for Wireplumber policy implementation
Add hopefully temporary workarounds for current Wireplumber policy implementation that requires taking gstreamer state to READY or STOPPED to trigger policy. Also add a fix for resuming playback from corked state. Bug-AGL: SPEC-3061, SPEC-3023 Change-Id: I1020f9de1fc7dc82c3bb58f0870880ecbf4c09ef Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'binding/radio_impl_kingfisher.c')
-rw-r--r--binding/radio_impl_kingfisher.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/binding/radio_impl_kingfisher.c b/binding/radio_impl_kingfisher.c
index ef3bf1c..f2893cf 100644
--- a/binding/radio_impl_kingfisher.c
+++ b/binding/radio_impl_kingfisher.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017,2018 Konsulko Group
+ * Copyright (C) 2017-2019 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,10 @@
#define GST_PIPELINE_LEN 256
+// Flag to enable using GST_STATE_READY instead of GST_STATE_PAUSED to trigger
+// Wireplumber policy mechanism. Hopefully temporary.
+#define WIREPLUMBER_WORKAROUND
+
// Structure to describe FM band plans, all values in Hz.
typedef struct {
char *name;
@@ -200,7 +204,11 @@ static int kf_init(void)
}
// Start pipeline in paused state
+#ifdef WIREPLUMBER_WORKAROUND
+ gst_element_set_state(pipeline, GST_STATE_READY);
+#else
gst_element_set_state(pipeline, GST_STATE_PAUSED);
+#endif
gst_bus_add_watch(gst_element_get_bus(pipeline), (GstBusFunc) handle_message, NULL);
@@ -341,10 +349,11 @@ static void kf_start(void)
if(!present)
return;
- if(!running) {
+ if(!running || corking) {
// Start pipeline
gst_element_set_state(pipeline, GST_STATE_PLAYING);
running = true;
+ corking = false;
}
}
@@ -355,7 +364,12 @@ static void kf_stop(void)
if(present && running) {
// Stop pipeline
running = false;
+#ifdef WIREPLUMBER_WORKAROUND
+ gst_element_set_state(pipeline, GST_STATE_READY);
+#else
gst_element_set_state(pipeline, GST_STATE_PAUSED);
+#endif
+ corking = false;
// Flush pipeline
// This seems required to avoid stutters on starts after a stop