GNOME Bugzilla – Bug 332611
[basesrc] needs way to prevent expensive start/stop in check_range function
Last modified: 2006-03-06 19:56:14 UTC
GstBaseSrc does basically: static gboolean gst_base_src_check_get_range (GstPad * pad) { if (!GST_OBJECT_FLAG_IS_SET (src, GST_BASE_SRC_STARTED)) { gst_base_src_start (src); gst_base_src_stop (src); } return src->random_access; } which means that whenever there's a typefind element involved (ie. always when used via playbin/decodebin), the source device will be opened/closed once just to check whether direct access is possible. That's bad, especially when the open/close is expensive, like in the case of dvd:// or cdda:// access. In the case of http, connecting twice to a http server within a very short period of time might lead to the connection being refused on the second (real) attempt (see bug #331690). The solution for dvd/cdda sources is simple - they can just set up a new checkrange function of their own on the pad that always returns FALSE. For something like GnomeVfsSrc it's not that straight-forward, as things depend on the URI protocol. Of course it could be hacked around, but I think it's a general problem that should be addressed in GstBaseSrc, maybe by adding a new vfunc.
Created attachment 60772 [details] [review] proposed patch, adds ::check_get_range vfunc to GstBaseSrc
On second thought, maybe we should call it ::check_random_access() instead?
Created attachment 60785 [details] [review] updated patch
Committed: 2006-03-06 Tim-Philipp Müller <tim at centricular dot net> * libs/gst/base/gstbasesrc.c: (gst_base_src_class_init), (gst_base_src_init), (gst_base_src_pad_check_get_range), (gst_base_src_default_check_get_range): * libs/gst/base/gstbasesrc.h: Add ::check_get_range() vfunc to GstBaseSrc (#332611), provide default implementation, and rename gst_base_src_check_get_range() to gst_base_src_pad_check_get_range() for clarity.