diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2014-02-13 10:21:15 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-02-13 10:44:58 +0100 |
commit | a1d9f6c79627475bc9cc7f210a735328dc421261 (patch) | |
tree | e6326d5adfcd44613ebdc9987ba025da50fdc85b /gst-libs/gst/uridownloader | |
parent | c76ea2919fb666dc62a58ee1f3bbfcfe0445e042 (diff) | |
download | gstreamer-plugins-bad-a1d9f6c79627475bc9cc7f210a735328dc421261.tar.gz |
uridownloader: Keep alive connections if the source supports that
Diffstat (limited to 'gst-libs/gst/uridownloader')
-rw-r--r-- | gst-libs/gst/uridownloader/gsturidownloader.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gst-libs/gst/uridownloader/gsturidownloader.c b/gst-libs/gst/uridownloader/gsturidownloader.c index b68cd878e..8b81e5a06 100644 --- a/gst-libs/gst/uridownloader/gsturidownloader.c +++ b/gst-libs/gst/uridownloader/gsturidownloader.c @@ -334,7 +334,18 @@ gst_uri_downloader_set_uri (GstUriDownloader * downloader, const gchar * uri, downloader->priv->urisrc = NULL; GST_DEBUG_OBJECT (downloader, "Can't re-use old source element"); } else { + GError *err = NULL; + GST_DEBUG_OBJECT (downloader, "Re-using old source element"); + if (!gst_uri_handler_set_uri (GST_URI_HANDLER (downloader->priv->urisrc), + uri, &err)) { + GST_DEBUG_OBJECT (downloader, "Failed to re-use old source element: %s", + err->message); + g_clear_error (&err); + gst_element_set_state (downloader->priv->urisrc, GST_STATE_NULL); + gst_object_unref (downloader->priv->urisrc); + downloader->priv->urisrc = NULL; + } } g_free (old_uri); g_free (old_protocol); @@ -353,6 +364,8 @@ gst_uri_downloader_set_uri (GstUriDownloader * downloader, const gchar * uri, gobject_class = G_OBJECT_GET_CLASS (downloader->priv->urisrc); if (g_object_class_find_property (gobject_class, "compress")) g_object_set (downloader->priv->urisrc, "compress", compress, NULL); + if (g_object_class_find_property (gobject_class, "keep-alive")) + g_object_set (downloader->priv->urisrc, "keep-alive", TRUE, NULL); /* add a sync handler for the bus messages to detect errors in the download */ gst_element_set_bus (GST_ELEMENT (downloader->priv->urisrc), |