From 7120a21d0880df6aa9f1c3cb7f7224699a6fe033 Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Thu, 19 Dec 2019 10:05:23 -0500 Subject: Some fixes for corked state tracking Fixes: - Clear the corked state flag on stop and track changes to keep it in sync. - Add changing of pipeline state in response to the GstBus GST_MESSAGE_REQUEST_STATE message, this is required to have the second request to switch back to PLAYING state be sent, and hence properly keeping track of corked state. Bug-AGL: SPEC-3061, SPEC-3047 Signed-off-by: Scott Murray Change-Id: I7a7727e1671b82aaafe816d30481bef720f19037 --- binding/afm-mediaplayer-binding.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'binding') diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c index 36b2ad0..b0ee725 100644 --- a/binding/afm-mediaplayer-binding.c +++ b/binding/afm-mediaplayer-binding.c @@ -235,6 +235,8 @@ static int set_media_uri(struct playlist_item *item, int state) AFB_DEBUG("GSTREAMER playbin.state = GST_STATE_PAUSED"); #endif } + // We can't be corked at this point + data.corked = FALSE; double vol = (double) data.volume / 100.0; g_object_set(data.playbin, "volume", vol, NULL); @@ -481,6 +483,7 @@ static void gstreamer_controls(afb_req_t request) AFB_DEBUG("GSTREAMER playbin.state = GST_STATE_PAUSED"); #endif data.playing = FALSE; + data.corked = FALSE; /* metadata event */ jresp = populate_json_metadata(); @@ -838,8 +841,13 @@ static gboolean handle_message(GstBus *bus, GstMessage *msg, CustomData *data) if (state == GST_STATE_PAUSED) { data->corked = TRUE; + // NOTE: Explicitly using PAUSED here, this case currently + // is separate from the general PAUSED/READY issue wrt + // Wireplumber policy. + gst_element_set_state(data->playbin, GST_STATE_PAUSED); } else if (state == GST_STATE_PLAYING) { data->corked = FALSE; + gst_element_set_state(data->playbin, GST_STATE_PLAYING); } g_mutex_unlock(&mutex); -- cgit 1.2.3-korg