From c3f86005deb5926cfac23def60e9ecd507f11076 Mon Sep 17 00:00:00 2001 From: Hou Qi Date: Mon, 2 Sep 2024 18:25:56 +0900 Subject: [PATCH] gstplay: check whether stream is seekable before seeking when state change If state is changing from playing to paused, and rate is reset to 1 which causes seek position is valid, current code will do seek for streams that are not seekable. So need to check whether stream is seekable before seeking. Part-of: --- subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 2527aab7cb..dac6998fc1 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c @@ -1422,8 +1422,12 @@ state_changed_cb (G_GNUC_UNUSED GstBus * bus, GstMessage * msg, } if (self->seek_position != GST_CLOCK_TIME_NONE) { - GST_DEBUG_OBJECT (self, "Seeking now that we reached PAUSED state"); - gst_play_seek_internal_locked (self); + if (!self->media_info->seekable) { + GST_DEBUG_OBJECT (self, "Media is not seekable"); + } else { + GST_DEBUG_OBJECT (self, "Seeking now that we reached PAUSED state"); + gst_play_seek_internal_locked (self); + } g_mutex_unlock (&self->lock); } else if (!self->seek_pending) { g_mutex_unlock (&self->lock);