diff options
author | Scott Murray <scott.murray@konsulko.com> | 2019-12-16 19:59:25 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2019-12-16 20:04:12 -0500 |
commit | 174b63ed864873c197c30831ee029d211c490034 (patch) | |
tree | 4a45db12138aca2b7513679d7338bf57832d51a2 | |
parent | b0cdc2b0ab623be1841ba4b60d1755f5bf706283 (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: I93c574f507e5e188f367d77fe59e089158cbab9c
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
-rw-r--r-- | binding/radio_impl_kingfisher.c | 18 | ||||
-rw-r--r-- | binding/radio_output_gstreamer.c | 14 |
2 files changed, 29 insertions, 3 deletions
diff --git a/binding/radio_impl_kingfisher.c b/binding/radio_impl_kingfisher.c index 8455ade..937fa98 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 diff --git a/binding/radio_output_gstreamer.c b/binding/radio_output_gstreamer.c index 6b938fd..5359deb 100644 --- a/binding/radio_output_gstreamer.c +++ b/binding/radio_output_gstreamer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018, 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. @@ -24,6 +24,10 @@ #include "radio_output.h" #include "rtl_fm.h" +// Flag to enable using GST_STATE_READY instead of GST_STATE_PAUSED to trigger +// Wireplumber policy mechanism. Hopefully temporary. +#define WIREPLUMBER_WORKAROUND + // Output buffer static unsigned int extra; static int16_t extra_buf[1]; @@ -96,7 +100,11 @@ int radio_output_open() NULL); // 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 // Set up output buffer extra = 0; @@ -129,7 +137,11 @@ void radio_output_stop(void) if(pipeline && 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 // Flush pipeline // This seems required to avoid stutters on starts after a stop |