aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-12-12 11:04:40 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-12-14 15:15:26 -0800
commitff6e4a14062aae6cfa0e381d186185287cd838cd (patch)
tree7e1a8ccaf15fe22124163d6180e0258dc76634df
parent64d3918ab5fe49be0d44a2aef4f338e89091fc57 (diff)
mediaplayer: check for corking from PipeWireicefish_8.99.3icefish/8.99.38.99.3
Check if PipeWire is corking the audio stream and if so don't process signal-composer events till uncorked. Bug-AGL: SPEC-3023 Change-Id: Ib4d4de1f1627426d69e3f19501d38ff2d3c88a62 Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--binding/afm-mediaplayer-binding.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index b2e73d9..6b487d1 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -66,6 +66,7 @@ typedef struct _CustomData {
GstElement *playbin, *fake_sink, *audio_sink;
gboolean playing;
int loop_state;
+ gboolean corked;
gboolean one_time;
long int volume;
gint64 position;
@@ -78,6 +79,7 @@ typedef struct _CustomData {
CustomData data = {
.volume = 50,
+ .corked = FALSE,
.position = GST_CLOCK_TIME_NONE,
.duration = GST_CLOCK_TIME_NONE,
};
@@ -805,6 +807,23 @@ static gboolean handle_message(GstBus *bus, GstMessage *msg, CustomData *data)
break;
}
+ case GST_MESSAGE_REQUEST_STATE: {
+ GstState state;
+
+ gst_message_parse_request_state(msg, &state);
+
+ g_mutex_lock(&mutex);
+
+ if (state == GST_STATE_PAUSED) {
+ data->corked = TRUE;
+ } else if (state == GST_STATE_PLAYING) {
+ data->corked = FALSE;
+ }
+
+ g_mutex_unlock(&mutex);
+
+ break;
+ }
default:
break;
}
@@ -1001,6 +1020,7 @@ static void onevent(afb_api_t api, const char *event, struct json_object *object
json_object *tmp = NULL;
const char *uid;
const char *value;
+ int corked;
json_object_object_get_ex(object, "uid", &tmp);
if (tmp == NULL)
@@ -1010,6 +1030,14 @@ static void onevent(afb_api_t api, const char *event, struct json_object *object
if (strncmp(uid, "event.media.", 12))
return;
+ g_mutex_lock(&mutex);
+ corked = data.corked;
+ g_mutex_unlock(&mutex);
+
+ // drop events if we are in corked state
+ if (corked)
+ return;
+
json_object_object_get_ex(object, "value", &tmp);
if (tmp == NULL)
return;