Commit graph

9 commits

Author SHA1 Message Date
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