uri-asset: Check if file exists before trying it as a proxy

This avoids:

  1- discovering file that we know do not exist
  2- proposing the current proxy path (that failed) as a possible proxy
     which lead to errors
This commit is contained in:
Thibault Saunier 2013-10-11 17:00:22 -03:00
parent 87ca058e3f
commit ee36beb244
2 changed files with 9 additions and 2 deletions

View file

@ -587,7 +587,9 @@ ges_asset_set_proxy (GESAsset * asset, const gchar * new_id)
return FALSE; return FALSE;
} else if (g_strcmp0 (asset->priv->proxied_asset_id, new_id) == 0) { } else if (g_strcmp0 (asset->priv->proxied_asset_id, new_id) == 0) {
GST_WARNING_OBJECT (asset, "Trying to proxy to same currently set proxy"); GST_WARNING_OBJECT (asset,
"Trying to proxy to same currently set proxy: %s -- %s",
asset->priv->proxied_asset_id, new_id);
return FALSE; return FALSE;
} }

View file

@ -141,7 +141,12 @@ _request_id_update (GESAsset * self, gchar ** proposed_new_id, GError * error)
gchar *basename = g_file_get_basename (file); gchar *basename = g_file_get_basename (file);
GFile *new_file = g_file_get_child (new_parent, basename); GFile *new_file = g_file_get_child (new_parent, basename);
*proposed_new_id = g_file_get_uri (new_file); /* FIXME Handle the GCancellable */
if (g_file_query_exists (file, NULL)) {
*proposed_new_id = g_file_get_uri (new_file);
GST_DEBUG_OBJECT (self, "Proposing path: %s as proxy",
*proposed_new_id);
}
gst_object_unref (new_file); gst_object_unref (new_file);
g_free (basename); g_free (basename);