From 06ee16b3ff31e10bc250e2aef61c989ef1f52ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 11 Mar 2006 16:40:20 +0000 Subject: [PATCH] ext/gnomevfs/gstgnomevfssrc.c: gnome_vfs_uri_is_local() alone is not a good indicator whether we can operate in pull-... Original commit message from CVS: * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_check_get_range): gnome_vfs_uri_is_local() alone is not a good indicator whether we can operate in pull-mode with a specific URI, as it returns FALSE for file:// URIs that point to an NFS-mounted path. Be more conservative here: whitelist local files, blacklist http URIs and use the old mechanism for anything else (fixes #334216). --- ChangeLog | 11 ++++++++++ ext/gnomevfs/gstgnomevfssrc.c | 41 +++++++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 656c3e660e..f320880b9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-03-11 Tim-Philipp Müller + + * ext/gnomevfs/gstgnomevfssrc.c: + (gst_gnome_vfs_src_check_get_range): + gnome_vfs_uri_is_local() alone is not a good indicator + whether we can operate in pull-mode with a specific URI, + as it returns FALSE for file:// URIs that point to an + NFS-mounted path. Be more conservative here: whitelist + local files, blacklist http URIs and use the old + mechanism for anything else (fixes #334216). + 2006-03-10 Thomas Vander Stichele * configure.ac: diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c index af8e4c8a54..e40c584c0e 100644 --- a/ext/gnomevfs/gstgnomevfssrc.c +++ b/ext/gnomevfs/gstgnomevfssrc.c @@ -1075,26 +1075,45 @@ static gboolean gst_gnome_vfs_src_check_get_range (GstBaseSrc * basesrc) { GstGnomeVFSSrc *src; - gboolean is_local; + const gchar *protocol; src = GST_GNOME_VFS_SRC (basesrc); if (src->uri == NULL) { GST_WARNING_OBJECT (src, "no URI set yet"); - /* don't know what to do, let the basesrc class decide for us */ - if (GST_BASE_SRC_CLASS (parent_class)->check_get_range) - return GST_BASE_SRC_CLASS (parent_class)->check_get_range (basesrc); - else - return FALSE; + return FALSE; } - is_local = gnome_vfs_uri_is_local (src->uri); + if (gnome_vfs_uri_is_local (src->uri)) { + GST_LOG_OBJECT (src, "local URI (%s), assuming random access is possible", + GST_STR_NULL (src->uri_name)); + return TRUE; + } - GST_LOG_OBJECT (src, "%s URI (%s), random access %spossible", - (is_local) ? "local" : "remote", GST_STR_NULL (src->uri_name), - (is_local) ? "" : "not "); + /* blacklist certain protocols we know won't work getrange-based */ + protocol = gnome_vfs_uri_get_scheme (src->uri); + if (protocol == NULL) + goto undecided; - return is_local; + if (strcmp (protocol, "http") == 0) { + GST_LOG_OBJECT (src, "blacklisted protocol '%s', no random access possible" + " (URI=%s)", protocol, GST_STR_NULL (src->uri_name)); + return FALSE; + } + + /* fall through to undecided */ + +undecided: + { + /* don't know what to do, let the basesrc class decide for us */ + GST_LOG_OBJECT (src, "undecided about URI '%s', let base class handle it", + GST_STR_NULL (src->uri_name)); + + if (GST_BASE_SRC_CLASS (parent_class)->check_get_range) + return GST_BASE_SRC_CLASS (parent_class)->check_get_range (basesrc); + + return FALSE; + } } static gboolean