From a7d0b074060993c5dc7290b142cd06d0cec96fa1 Mon Sep 17 00:00:00 2001 From: Elliot Chen Date: Wed, 24 Apr 2024 14:42:31 +0900 Subject: [PATCH] gstplay: query seek information again in playing state for live stream Part-of: --- .../gst-libs/gst/play/gstplay.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c index a6993402f9..90e0ebe96e 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c @@ -1452,6 +1452,28 @@ state_changed_cb (G_GNUC_UNUSED GstBus * bus, GstMessage * msg, on_duration_changed (self, duration); } } + + /* Try to query seek information again for live stream */ + if (self->is_live) { + gboolean seekable = FALSE; + gboolean updated = FALSE; + + GstQuery *query = gst_query_new_seeking (GST_FORMAT_TIME); + if (gst_element_query (self->playbin, query)) + gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL); + gst_query_unref (query); + + g_mutex_lock (&self->lock); + if (self->media_info && seekable != self->media_info->seekable) { + self->media_info->seekable = seekable; + updated = TRUE; + } + g_mutex_unlock (&self->lock); + + if (updated) { + on_media_info_updated (self); + } + } /* api_bus_post_message (self, GST_PLAY_MESSAGE_POSITION_UPDATED, */ /* GST_PLAY_MESSAGE_DATA_POSITION, GST_TYPE_CLOCK_TIME, 0, NULL); */