From d9045cbf0768cb743adf4123c2ca36710d73ed05 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Mon, 16 Dec 2019 19:59:25 -0500 Subject: 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 --- binding/radio_output_gstreamer.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'binding/radio_output_gstreamer.c') 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 -- cgit 1.2.3-korg