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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7441>
This commit is contained in:
Hou Qi 2024-09-02 18:25:56 +09:00 committed by GStreamer Marge Bot
parent 9a87ce418b
commit c3f86005de

View file

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