Commit graph

184 commits

Author SHA1 Message Date
Thiago Santos
11c61f14bf souphttpsrc: dynamically adjust blocksize
Update the blocksize depending on how much is obtained from a read
of the input stream. This avoids doing too many reads in small chunks
when larger amounts of data are available and also prevents using
a very large memory area to read a small chunk of data.

https://bugzilla.gnome.org/show_bug.cgi?id=767833
2016-06-29 09:51:02 -03:00
Tim-Philipp Müller
33fb50b308 soup: work around frequent deadlocks in GLib type initialisation
.. by registering the types from the plugin init function. This
seems to help, but we'll see if it's enough (might need similar
things elsewhere).

https://bugzilla.gnome.org/show_bug.cgi?id=693911
https://bugzilla.gnome.org/show_bug.cgi?id=674885
2016-06-17 19:59:13 +01:00
Sebastian Dröge
4a2455b744 Revert "WIP revert soup"
This reverts commit fdac3a7a23.

Was not supposed to be pushed but a local workaround for
https://bugzilla.gnome.org/show_bug.cgi?id=693911#c13
2016-06-06 10:47:52 +03:00
Sebastian Dröge
fdac3a7a23 WIP revert soup 2016-06-03 13:25:38 +03:00
Guillaume Desmottes
6fd04b07fc souphttpsrc: fix buffer leak when flushing
When early returning in gst_soup_http_src_read_buffer() because the
element is FLUSHING, we need to unmap and unref the buffer which was just created.

https://bugzilla.gnome.org/show_bug.cgi?id=766718
2016-05-20 17:40:26 +01:00
Sebastian Dröge
e2b2185029 souphttpclientsink: Set sent_buffers and streamheader_buffers to NULL after freeing
Otherwise we might use an already freed list later and crash or worse.
2016-05-19 12:44:17 +03:00
Carlos Rafael Giani
e9a795fa8b souphttpsrc: Use audio/x-unaligned-raw instead of audio/x-raw for L16 data
Directly setting audio/x-raw caps leads to problems when the delivered
data blocks do not align properly at sample boundaries (for example, a
data block with 391 bytes). So, instead, set audio/x-unaligned-raw to
let a parser be autoplugged.

https://bugzilla.gnome.org/show_bug.cgi?id=689460
2016-05-15 13:18:02 +03:00
Thiago Santos
325741d37d souphttpsrc: check if request was cancelled when sending message
It might be that the request was aborted by the application and
we can return immediatelly
2016-05-15 06:40:01 -03:00
Thiago Santos
075a6260fd souphttpsrc: proxy resolver is on by default
Remove from the session creation parameters
2016-05-15 06:36:25 -03:00
Thiago Santos
9b52a5b9af soup: update build to warn about newer deprecated functions
We already depend on 2.48
2016-05-15 06:36:25 -03:00
Thiago Santos
8816764112 souphttpsrc: reduce reading latency by using non-blocking read
Non-blocking read will return the amount of data available without
blocking to wait for the full requested size.

The downside is that now it souphttpsrc needs to have a waiting
mechanism in case there is no data available yet to avoid busy
looping arond the inputstream.
2016-05-15 06:36:25 -03:00
Thiago Santos
183695c61a souphttpsrc: refactor to use Soup's sync API
Replace the async API with the sync API to remove all the extra mainloop
and context handling. Currently it blocks reading until 'blocksize'
bytes are available but that can be improved by using:

https://developer.gnome.org/gio/unstable/GPollableInputStream.html#g-pollable-input-stream-read-nonblocking

https://bugzilla.gnome.org/show_bug.cgi?id=693911
2016-05-14 08:40:12 -03:00
Sebastian Dröge
bc2d4c4c31 souphttpclientsink: If no proxy is set by properties, use the default libsoup proxy resolver
That is, use whatever system settings there might exist. This is the same
behaviour we use in the HTTP source.
2016-04-15 11:36:36 +03:00
Vineeth TM
1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Xavier Claessens
10044b1d0f souphttpsrc: Add GTlsInteraction property
https://bugzilla.gnome.org/show_bug.cgi?id=750709
2015-12-14 14:56:02 -05:00
Vineeth TM
bd701b8ee5 souphttpclientsink: Fix error leak and handle error
g_thread_try_new allows for possiblity of failures. In case it fails,
error is not handled and leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=758260
2015-11-18 09:31:42 +02:00
Reynaldo H. Verdejo Pinochet
c9039751f1 souphttpsrc: remove unnecessary NULL checks before g_free() 2015-11-15 01:43:08 -08:00
Sebastian Dröge
51adc9d889 souphttpsrc: EOS immediately if we have an empty seek segment
https://bugzilla.gnome.org/show_bug.cgi?id=748316
2015-10-14 16:56:26 +03:00
Stavros Vagionitis
21c6da6764 souphttpsrc: Make non-inclusive segment boundaries inclusive
The problem is that the filesrc and souphttpsrc are behaving
differently regarding the calculation of the segment boundaries. The
filesrc is using a non-inclusive boundaries, while the souphttpsrc
uses inclusive. Currently the hlsdemux calculates the boundaries as
inclusive, so for this reason there is no problem with the souphttpsrc,
but there is an issue in the filesrc.

The GstSegment is non-inclusive, so the proposed solution is to use
non-inclusive boundaries in the hlsdemux in order to be consistent.
Make the change in the hlsdemux, will break the souphttpsrc, which
will expect inclusive boundaries, but the hlsdemux will offer
non-inclusive. This change makes sure that the non-inclusive
boundaries are converted to inclusive.

https://bugzilla.gnome.org/show_bug.cgi?id=748316
2015-10-14 16:56:22 +03:00
Graham Leggett
af25e3cc93 souphttpclientsink: Add the retry and retry-delay properties
These allow a failed request to be retried after the given number of seconds
instead of failing the pipeline. Take account of the Retry-After header if
present. Add retries parameter that controls the number of times an HTTP
request will be retried before failing.

https://bugzilla.gnome.org/show_bug.cgi?id=756318
2015-10-14 15:23:00 +03:00
Vineeth TM
6eb8db8afd souphttpclientsink: Check if soup message is created
If soup message is not created then the same should not be passed
on, which is resulting in segfault. Hence throwing a warning message
and returning

https://bugzilla.gnome.org/show_bug.cgi?id=755326
2015-10-12 16:53:29 +03:00
Vineeth TM
2ee7b2b94d souphttpclientsink: Check if location being set is valid
Adding a check in set_property to find if the location uri is valid
and printing warning if not valid.

https://bugzilla.gnome.org/show_bug.cgi?id=755326
2015-10-12 16:53:28 +03:00
Vineeth TM
cece69003c souphttpclientsink: Fix memory leaks during failures
freeing streamheader_buffers and sent_buffers during failure cases.

https://bugzilla.gnome.org/show_bug.cgi?id=755326
2015-10-12 16:53:28 +03:00
Vineeth TM
b1d4e7e222 souphttpclientsink: Replace redundant free_buffer_list function
Removing free_buffer_list and replacing it with already available function
g_list_free_full

https://bugzilla.gnome.org/show_bug.cgi?id=755326
2015-10-12 16:53:28 +03:00
Thiago Santos
cb852cd128 souphttpsrc: remove unnecessary if, g_free is null safe 2015-08-14 06:43:13 -03:00
Alex Ashley
9dcc7d9cac souphttpsrc: add property to set HTTP method
To allow souphttpsrc to be use HTTP methods other than GET
(e.g. HEAD), add a "method" property that is a string. If this
property is not set, GET is used.

https://bugzilla.gnome.org/show_bug.cgi?id=752413
2015-08-14 06:37:55 -03:00
Tim-Philipp Müller
e1143041ed soup: fix typo in translated string
https://bugzilla.gnome.org/show_bug.cgi?id=753240
2015-08-04 16:28:17 +01:00
Eunhae Choi
8b6a261703 souphttpsrc: handle empty http proxy string
1) If the system http_proxy environment variable is not set
or set to an empty string, we must not set proxy to avoid
http connection error.

2) In case of proxy property setting, if user want to clear
the proxy setting, they should be able to set it to NULL or
an empty string again, so this is fixed too.

3) Check if the proxy string was parsed correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=752866
2015-07-31 10:54:02 +01:00
Xavier Claessens
64e4df3fe2 souphttpsrc: Add tls-database property
https://bugzilla.gnome.org/show_bug.cgi?id=750298
2015-06-10 14:10:39 -04:00
Xavier Claessens
5ada1a6cf8 souphttpsrc: fix getter of "ssl-use-system-ca-file"
https://bugzilla.gnome.org/show_bug.cgi?id=750298
2015-06-10 12:02:16 +01:00
Sebastian Dröge
8965619f13 souphttpclientsink: Implement cookies property 2015-03-08 18:04:34 +01:00
Sebastian Dröge
b2bcb3d61f souphttpclientsink: Implement automatic-redirect property 2015-03-08 18:02:51 +01:00
Sebastian Dröge
814f741a28 souphttpclientsink: Implement proxy support
The properties were there before, but not used anywhere.
2015-03-08 17:54:42 +01:00
Sebastian Dröge
bbcfc3b9e6 souphttpsrc: Don't return a buffer when returning not GST_FLOW_OK
basesrc assumes that we don't return a buffer if
something else than OK is returned. It will just
leak any buffer we might accidentially provide
here.

This can potentially happen during flushing.

Maybe fixes https://bugzilla.gnome.org/show_bug.cgi?id=741993
2014-12-30 16:28:09 +01:00
Branislav Katreniak
1e03ffb820 souphttpsrc: log connection events at info level
https://bugzilla.gnome.org/show_bug.cgi?id=739305
2014-11-22 15:14:58 +00:00
Nirbheek Chauhan
f35f3ccf7c souphttpclientsink: Fix lifetime of stream headers and queued buffers
Stream headers are updated whenever ::set_caps is called, so we can't assume
they'll be valid before the message body is written out. We *can* assume that
for queued buffers, but SOUP_MEMORY_STATIC is still wrong for those.

Also, add some debug logging for stream header interactions.

https://bugzilla.gnome.org/show_bug.cgi?id=737771
2014-10-02 12:47:36 +03:00
Nirbheek Chauhan
374552a720 souphttpclientsink: Add some more useful debug logging 2014-10-02 09:48:49 +03:00
Nirbheek Chauhan
745d497318 souphttpclientsink: Free queued buffers in ::reset
::render sets a new callback for writing out new buffers only if there aren't
already buffers queued for writing with a previously-scheduled callback.
However, if the previously-scheduled callback is interrupted by a state change
(either manually or due to an error) and there are still buffers in the queue,
restarting the pipeline will result in buffers being queued forever, and no
callbacks will ever be scheduled, and no buffers will be written out.

https://bugzilla.gnome.org/show_bug.cgi?id=737739
2014-10-02 09:48:27 +03:00
Sebastian Dröge
53b5a44a06 souphttpsrc: If the server reports "Accept-Ranges: none" don't try range requests 2014-09-11 12:53:29 +03:00
Sebastian Dröge
4b697df494 souphttpsrc: Include redirection target in error messages
Just giving the original URI can give the false impression that e.g.
that one failed host name resolution, while actually the redirection target
did.
2014-09-04 12:14:11 +03:00
Sebastian Dröge
edc7d9027e souphttpsrc: Add custom sticky event to contain the HTTP request and response headers
This can be useful to e.g. get cookie information downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=729707
2014-05-28 09:20:21 +02:00
Sebastian Dröge
2a7abc98db souphttpsrc: Clean up all pending operations from libsoup before unreffing our context
When we cancel connection attempts and similar things, there are still
some operations pending on our main context from the GCancellables. We
should let them all run before unreffing our context, otherwise we leak
file descriptors.

Unfortunately this requires libsoup 2.47.0 or newer as earlier versions
steal our main context from us and we can't use it for cleanup later
without assertions and funny crashes.

Based on a patch by Dmitry Shatrov <shatrov@gmail.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=663944
2014-05-08 10:18:38 +02:00
Sebastian Dröge
3b6c17c2b6 souphttpsrc: Remember if a redirect is permanent or not and store it in the query 2014-04-28 10:04:03 +02:00
Sebastian Dröge
37609c0a82 souphttpsrc: Only keep-alive the connection in stop() if we have finished all previous messages
After cancelling a request we need to create a new connection.
2014-04-11 13:30:53 +02:00
Sebastian Dröge
847ba2a30d souphttpsrc: Also retry on unexpected network failures 2014-04-10 16:47:21 +02:00
Sebastian Dröge
037dfb6723 souphttpsrc: New property to specify the maximum number of retries before we give up 2014-04-10 16:47:07 +02:00
Alexander Zallesov
b089524b21 souphttpsrc: Change default timeout to 15 seconds
If nothing happens after 15 seconds, chances are good that
our connection will never will work. Stop after 15 seconds
instead of waiting until the system's default timeout, which
can be > 1 minute.
2014-04-10 11:11:35 +02:00
Sebastian Dröge
d918212e12 souphttpsrc: Use GST_FLOW_FLUSHING when flushing, not GST_FLOW_EOS
... and reset it properly after flushing is done. Fixes playback
in many cases when buffering is used.

https://bugzilla.gnome.org/show_bug.cgi?id=727821
2014-04-09 10:56:29 +02:00
Sebastian Dröge
5d06735dbd souphttpsrc: Add properties for selecting SSL/TLS certificate checking
And by default properly check certificates against the system's CA
certificates. Everything else is not a good default at all.
2014-03-12 15:32:55 +01:00
Sebastian Dröge
ac83961033 souphttpsrc: Make sure to not return EOS immediately if we finished a range request
Only return EOS the next time create() is called, if at all. basesrc
should already take care of not calling it again.

Also always return immediately if the previous flow return was
not OK. This indicates an error somewhere.
2014-03-07 16:56:51 +01:00