GNOME Bugzilla – Bug 326998
GstBaseSrc's send_event handler ignores seek requests after pad activation
Last modified: 2006-03-27 11:49:02 UTC
Scenario: int main (int argc, char **argv) { GstElement *src; gst_init (&argc, &argv); src = gst_element_factory_make ("cdparanoiasrc", NULL); gst_element_set_state (src, GST_STATE_PAUSED); gst_element_get_state (src, NULL, NULL, -1); /* seek to track #3 (2 as counting from 0 here) */ gst_element_seek (src, 1.0, gst_format_get_by_nick ("track"), 0, GST_SEEK_TYPE_SET, 2, GST_SEEK_TYPE_NONE, 0); gst_element_set_state (src, GST_STATE_PLAYING); ... } This seek request is going to be swallowed, because gst_base_src_send_event() simply saves the seek request as pending_seek, which is only ever looked at at pad activation time, so it's never executed when we're after pad activation already.
yah, silly. the event should only be stored when the element is not able to respond immediatly.
Hello! Judging from the ChangeLog, it looks like you implemented seeking in gstbasesrc.c. May I suggest the following patch to enable seeking on elements (not pads) that are running? Currently, you just store the event in data.ABI.pending_seek which is checked in gst_base_src_activate_push. But if the pipeline is running and gst_base_src_activate_push has already been called, the seek will never be performed. Thanks a lot! Regards Lutz Müller Index: gstbasesrc.c =================================================================== RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasesrc.c,v retrieving revision 1.99 diff -u -3 -p -b -B -d -r1.99 gstbasesrc.c --- gstbasesrc.c 8 Mar 2006 13:44:55 -0000 1.99 +++ gstbasesrc.c 24 Mar 2006 21:57:03 -0000 @@ -884,6 +884,10 @@ gst_base_src_send_event (GstElement * el switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: { + if (GST_PAD_ACTIVATE_MODE (GST_BASE_SRC_PAD (src)) == GST_ACTIVATE_PUSH) { + result = gst_base_src_perform_seek (src, event, FALSE); + break; + } GST_OBJECT_LOCK (src); /* gst_event_replace? */ if (src->data.ABI.pending_seek)
Inspired by a patch of: Lutz Mueller <lutz at topfrose dot de> * libs/gst/base/gstbasesrc.c: (gst_base_src_finalize), (gst_base_src_send_event), (gst_base_src_change_state): Handle element seek correctly when we are streaming. Fixes #326998.