gstplay: query seek information again in playing state for live stream

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6681>
This commit is contained in:
Elliot Chen 2024-04-24 14:42:31 +09:00 committed by GStreamer Marge Bot
parent 9e4cb46bd4
commit a7d0b07406

View file

@ -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); */