Commit graph

18 commits

Author SHA1 Message Date
Sebastian Dröge
a1d9f6c796 uridownloader: Keep alive connections if the source supports that 2014-02-13 10:44:58 +01:00
Sebastian Dröge
c76ea2919f uridownloader: Re-use old source element if possible
Allows to implement keep-alive handling in the source element.
2014-02-13 10:06:48 +01:00
Sebastian Dröge
d436844434 uridownloader: Fix potential deadlock
The streaming thread might use our lock, so shutting
down the element while holding that lock calls for problems.
2014-02-12 18:06:43 +01:00
Sebastian Dröge
8cd6208b7d uridownloader: Shutdown the source element before unlinking it
Otherwise we might get warnings about pushing to unlinked pads.

Based on a patch by Andoni Morales.
2014-02-12 18:01:10 +01:00
Sebastian Dröge
2a38c1409b uridownloader: Add support for compressed downloads
Very useful for playlists, less useful for media files.
2014-02-12 13:08:29 +01:00
Sebastian Dröge
3726c00b95 uridownloader: Reset cancelled state after fetching an URI
Otherwise it will never ever be able to fetch anything after an
error until the user resets it manually.
2014-02-11 15:26:01 +01:00
Sebastian Dröge
d445374067 uridownloader: Provide some more details about errors if downloading fails 2014-02-11 14:13:30 +01:00
Duncan Palmer
06dd8839f4 uridownloader: Fix race condition between EOS handling and downloading a range
https://bugzilla.gnome.org/show_bug.cgi?id=723134
2014-02-04 12:53:00 +01:00
Duncan Palmer
06fec6709d uridownloader: Always release the object lock in gst_uri_downloader_fetch_uri_with_range()
even if downloader->priv->urisrc is not set. This avoids deadlock under some
some conditions on cancel.

https://bugzilla.gnome.org/show_bug.cgi?id=723127
2014-01-29 20:38:57 +01:00
Thiago Santos
5a5f6d1b7a uridownloader: fix deadlock near EOS
A deadlock can happen when the source sends EOS when
being put to NULL as the object lock is being held by the
thread that sets the element to NULL and is needed by
the event handler.
2013-12-24 17:07:52 -03:00
Thiago Santos
c62137b832 uridownloader: fix crash when download is null
Do no try to unref a NULL download attribute
2013-07-08 23:39:49 -03:00
Thiago Santos
9e313eb0a7 uridownloader: do not set cancelled unless explicitly called by user
Cancelled is a 'permanent' state of the uridownloader and is only
removed by a call to _reset. When a download fails we just want to
return NULL on the fetch function and leave the downloader ready
for another fetch, otherwise the user has to call _reset after
failed downloader, even when it didn't call _cancel.
2013-07-08 23:39:49 -03:00
Thiago Santos
cd26bd51a1 uridownloader: Simplify locking to fix deadlocks
Use object lock to protect variables from concurrent access and
use download_lock to only allow one download running
2013-07-03 10:23:45 -03:00
Thiago Santos
e76f3e95fd uridownloader: add support for range based downloads
Adds a new API gst_uri_downloader_fetch_uri_with_range that allows
downloading only a byte range from an URI. It uses a seek event
sent to the source to signal the range to be downloaded.

https://bugzilla.gnome.org/show_bug.cgi?id=702206
2013-07-01 14:22:01 -03:00
Louis-Francis Ratté-Boulianne
f0211e5b7b uridownloader: unlock mutex when switching urisrc state to NULL to avoid deadlock
When chain method was called after gst_uri_downloader_stop and before state has been changed to NULL, execution was blocking on g_mutex_lock.

Conflicts:
	gst-libs/gst/uridownloader/gsturidownloader.c
2013-05-07 20:02:41 -03:00
Thiago Santos
99efe87b5d uridownloader: properly unref the urisrc between downloads
This prevents leaking the element. Also sets the bus to flushing
to completely reset the downloader state
2013-05-07 20:02:41 -03:00
Andre Moreira Magalhaes (andrunko)
f72869816c uridownloader: make cancelled state 'permanent' until a reset
When downloading and cancelling quickly the uridownloader object and the
element using it could miss the cancelled window and the uridownloader
would fetch the wrong URI and block on subsequent fetches.

This was also problematic when stopping elements, while one task would
call the cancel, another element thread could issue a new fetch_uri. As
the cancel state isn't 'permanent' this fetch_uri would block and
prevent the whole element from stopping and going to NULL.

This patch makes the 'cancelled' state permanent until a
gst_uri_downloader_reset is called. This way the element knows the
window where the uridownloader isn't active and only reactivate it when
ready.
2013-05-07 20:02:41 -03:00
Thiago Santos
859635ca01 uridownloader: refactor gsturidownloader to its own lib
gsturidownloader can be reused by other plugins, better have it
into its own lib
2013-05-07 20:02:41 -03:00