After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 332611 - [basesrc] needs way to prevent expensive start/stop in check_range function
[basesrc] needs way to prevent expensive start/stop in check_range function
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 331690
Reported: 2006-02-26 11:35 UTC by Tim-Philipp Müller
Modified: 2006-03-06 19:56 UTC
See Also:
GNOME target: ---
GNOME version: ---

proposed patch, adds ::check_get_range vfunc to GstBaseSrc (2.48 KB, patch)
2006-03-06 17:46 UTC, Tim-Philipp Müller
none Details | Review
updated patch (3.97 KB, patch)
2006-03-06 19:42 UTC, Tim-Philipp Müller
committed Details | Review

Description Tim-Philipp Müller 2006-02-26 11:35:38 UTC
GstBaseSrc does basically:

static gboolean
gst_base_src_check_get_range (GstPad * pad)
    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.
Comment 1 Tim-Philipp Müller 2006-03-06 17:46:16 UTC
Created attachment 60772 [details] [review]
proposed patch, adds ::check_get_range vfunc to GstBaseSrc
Comment 2 Tim-Philipp Müller 2006-03-06 17:49:13 UTC
On second thought, maybe we should call it ::check_random_access() instead?
Comment 3 Tim-Philipp Müller 2006-03-06 19:42:50 UTC
Created attachment 60785 [details] [review]
updated patch
Comment 4 Tim-Philipp Müller 2006-03-06 19:56:14 UTC

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),
        * 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.