Commit graph

205 commits

Author SHA1 Message Date
Tim-Philipp Müller
17f0faa368 hlsdemux: put boolean values into gboolean variables
And remove superfluous assignments.
2016-01-06 15:25:04 +00:00
Thiago Santos
bf57be7fc7 hlsdemux: fix reverse playback seek with snap flags
Properly handle snap flags during reverse seeking. In this case
the before/after are also reversed, so handle those as such.

For example: with a sequence of 1s fragments:

|-- 0 --|-- 1 --|-- 2 --|-- 3 --|

If you seek to 1.5s it is inside fragment 1. With reverse and

snap-before: should play from the end of fragment 1
snap-after: should play from the end of fragment 0
2016-01-06 10:23:13 -03:00
Thiago Santos
5d87f68f6c hlsdemux: simplify snap flags checking
Replace:
if (boolean) var = true;

with:
var = (boolean);
2016-01-06 10:23:13 -03:00
Thiago Santos
b8e0c365c4 hlsdemux: respect keyunit flag for position
Set the segment start position when keyunit flag is active
2016-01-06 10:23:13 -03:00
Thiago Santos
a072101441 hlsdemux: make sure every bad update_playlist return sets an error
Otherwise it segfaults when reporting the error in the bus
2015-12-22 10:16:16 -03:00
Tim-Philipp Müller
d5e115171b hlsdemux: reflow update_playlist a bit
Reduce indentation by erroring out directly on failure.
2015-12-19 21:12:17 +00:00
Tim-Philipp Müller
8be5551dff hlsdemux: fix potential error leak
Clear error as soon as we determine that the download failed,
otherwise there are code paths where we might return without
clearing it ever, which would leak the GError then. Also, we
can pass a NULL GError pointer to _fetch_uri(), so just do that
instead of passing one that we're going to just free again
right away anyway.
2015-12-19 21:06:02 +00:00
Thiago Santos
29de588e2f hlsdemux: always set timestamp on reverse playback
Downstream needs to be able to restore the timestamps after a discont
to do reverse playback

https://bugzilla.gnome.org/show_bug.cgi?id=759592
2015-12-18 18:52:03 -03:00
Duncan Palmer
612f16936c hlsdemux: add support for seeking to fragment boundaries
Setting the seek flags to GST_SEEK_FLAG_SNAP_* will change the seek
target time to a segment boundary.

Based on original work by Ben Willers <bwillers@digisoft.tv>.

https://bugzilla.gnome.org/show_bug.cgi?id=759108
2015-12-08 09:57:24 +02:00
Maroš Ondrášek
905158a055 hlsdemux: update current variant if connection speed is set
If connection speed is set, playlist according
to connection speed is selected as current playlist.

Problem is that the current variant of main playlist still
points to previously set variant.
If previously set variant doesn't correspond to current
playlist, then it causes unnecessary change of playlist
to the same playlist after first fragment is downloaded,
because of not updated current variant.

To fix this, we need to make sure that current variant
of main playlist corresponds to the current playlist

https://bugzilla.gnome.org/show_bug.cgi?id=758946
2015-12-02 14:39:12 +02:00
Jan Schmidt
77b302b5da hlsdemux: Tell the base class the fragment duration
adaptivedemux uses the fragment duration as a delay
in some cases, so make sure to set it.
2015-12-02 22:29:38 +11:00
Jan Schmidt
952275ad99 hlsdemux: When switching bitrate variants, don't jump back
Don't jump backward to 3 files from the end of the playlist
when switching variants - it just means we downloaded
fragments fast and caught up to the end of the playlist.

Disable that by treating a variant switch as a playlist
update, not a restart due to a seek or so.
2015-12-02 22:29:38 +11:00
Tim-Philipp Müller
64adb1998d hlsdemux: fix crash when decryption key can't be downloaded
Happened with
http://sslhls.m6tv.cdn.sfr.net/hls-live/livepkgr/_definst_/m6_hls_aes/m6_hls_aes_856.m3u8
if glib-networking was not installed (since key has https uri).
2015-12-01 18:01:36 +00:00
Tim-Philipp Müller
97ea56e91c hls: m3u8: remove pointless client_has_main() function
We always have a main list.
2015-12-01 17:51:34 +00:00
Sebastian Dröge
fac4ed18d4 hlsdemux: Always give timestamps if we're discont and don't mark stream discont if a playlist change was not successful
If the stream is discont, we must provide a timestamp in any case. Elements
like tsdemux are not going to output anything if we give a NONE timestamp
after a discont.

Also marking a stream as discont if a playlist change was not successful would
lead to the above situation, but in that case we are not required at all to
mark the stream discont as we're still at the old playlist.
2015-12-01 19:47:59 +02:00
Reynaldo H. Verdejo Pinochet
86ec812429 Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2015-11-18 16:05:42 -08:00
Florin Apostol
eab158a669 adaptivedemux: fixed multithread support
https://bugzilla.gnome.org/show_bug.cgi?id=755169
2015-10-29 10:20:45 +00:00
Tim-Philipp Müller
344d100b1c hlsdemux: change dispose function to finalize 2015-10-23 18:51:43 +01:00
Tim-Philipp Müller
b8a155c17d hlsdemux: remove helper function only used once 2015-10-23 18:51:43 +01:00
Tim-Philipp Müller
917b034238 hlsdemux: remove deprecated 'fragments-cache' property
It's been non-functional for two cycles now, let's
get rid of it.
2015-10-23 18:51:18 +01:00
Edward Hervey
8d86a8b75d hlsdemux: Avoid negative sequence numbers
For live streams, we want to make sure there's a certain distance
between the sequence to play and the last (earliest) fragment.

The problem is that it assumes there are at least 3 fragments in
the playlist, which might not always be the case (like in the case
of a server restarting and gradually adding fragments).

In order to avoid ending up with negative sequence numbers (which
will just loop forever), limit the new target sequence number to
the highest of:
* either the first sequence number of the playlist (fallback)
* or 3 fragments from the last one (standard behaviour)
2015-10-14 18:01:04 +02:00
Philippe Normand
261d8daca0 adaptivedemux: prefix the statistics message name macro
Keep old define around for now.

https://bugzilla.gnome.org/show_bug.cgi?id=754686
2015-09-17 17:39:27 +01:00
Arnaud Vrac
a4cb032355 hlsdemux: abort playlist update when cancelled
Otherwise the download thread will get stuck, since the downloader is
disabled.
2015-08-19 16:22:44 +03:00
Jimmy Ohn
1270afae44 hlsdemux: Fix wrong gst-launch command in the description
Fix wrong gst-lauch command in the description.
This patch may help people to get right testing results using the script.

https://bugzilla.gnome.org/show_bug.cgi?id=750143
2015-06-05 12:21:41 -03:00
Thiago Santos
0a63fa7a01 hlsdemux: drop TODO that doesn't need a solution
Connection speed is only checked at that point in hlsdemux so there
is no real need to refactor it.

https://bugzilla.gnome.org/show_bug.cgi?id=749328
2015-06-05 09:43:31 -03:00
Thiago Santos
581d8c0b8d Revert "hlsdemux: Simplify logic in process_manifest"
This reverts commit 4ca3a22b6b.

The connection-speed=0 is used as a special value in the property
of hlsdemux to mean 'automatic' selection, m3u8.c doesn't need
to know about that as it should be as simple as possible.

So this patch hides this automatic selection documented in hlsdemux
into m3u8 logic and I think the gets harder to understand the code.

It also makes the hlsdemux unit tests work again

https://bugzilla.gnome.org/show_bug.cgi?id=749328
2015-06-05 09:43:10 -03:00
Thiago Santos
6f1c58dedf hlsdemux: remove more unused attributes
Those are not used or only read
2015-05-27 06:17:49 -03:00
Thiago Santos
030700a24b hlsdemux: remove unused attribute
It is never read for anything useful
2015-05-27 05:36:10 -03:00
Jimmy Ohn
4ca3a22b6b hlsdemux: Simplify logic in process_manifest
Simplify logic in process_manifest and remove a TODO item.

https://bugzilla.gnome.org/show_bug.cgi?id=749328
2015-05-18 10:52:35 +03:00
Sebastian Dröge
7c2a5da125 hlsdemux: Use the downloader of the base class instead of creating our own
The one of the base class is completely unused because we override all
the downloading here, so let's just use that one instead.
2015-04-23 17:47:18 +02:00
Sebastian Dröge
bb36ffb633 hlsdemux: Fix how the playlists are refreshed
We should only refresh the currently selected variant playlist (if any,
otherwise the main playlist), not the main playlist. And only try to
refresh the main playlist if updating the variant playlist fails.

Some servers (Wowza) use the request of the main playlist to create a
"session", which is then part of the URI of the variant playlist and
also the fragments. Refreshing the main playlist would generate a new
session, and the server rate limits that usually. And after a few retries
the server just kicks us out.

Also as a side effect we now use the same downloader for all playlists, so
that we only have 2 instead of 3 connections to the server. And also
previously we just ignored the downloaded data from the main playlist that
the base class gave to us.
2015-04-23 17:47:18 +02:00
Sebastian Dröge
0cd3938345 adaptivedemux: Allow subclasses to override how a new manifest would be downloaded 2015-04-23 17:47:18 +02:00
Thiago Santos
86a503a29b hlsdemux: handle too short segments
When the segment is very short it might be the case that the
typefinding fails and when finishing the segment hlsdemux would
consider the remaining data (pending_buffer) as an encryption
leftover.

This patch fixes it and makes sure an error is properly posted
if typefind failed by refactoring buffer handling to a function
and using it from the data_received and finish_fragment functions.
2015-04-22 20:21:02 -03:00
Thiago Santos
6c513a9d1e hlsdemux: use correct variable type
gst_buffer_resize needs gssize and not gsize. This makes gdb
print it correctly when debugging.
2015-04-22 19:04:43 -03:00
Sebastian Dröge
6c968ed3da hlsdemux: Fix seeking
We also have to update the current_file GList pointer in the M3U playlist
client, otherwise we are just continuing playback from the current position
instead of seeking.
2015-04-21 18:30:33 +02:00
Sebastian Dröge
1e1e73a0f2 hlsdemux: Don't call unlock() just to call lock() immediately afterwards 2015-04-21 18:30:33 +02:00
Thiago Santos
87f8d7890c hlsdemux: set timestamp on discont buffers
Make sure discont buffers have its timestamp set to allow downstream
to resync if needed
2015-03-04 08:00:48 -03:00
Thiago Santos
f79d9522c5 hlsdemux: remove unused define 2015-02-17 11:53:49 -03:00
Thiago Santos
f7a1649c77 adaptivedemux: add bitrate-limit property
Move the property from subclasses to adaptivedemux, it allows
selecing the percentage of the measured bitrate to be used when
selecting stream bitrates
2015-02-17 11:12:42 -03:00
Thiago Santos
e9ab79dc36 adaptivedemux: add connection-speed property
Allows to set a bitrate directly instead of measuring it internally
based on the received chunks. The connection-speed was removed from
mssdemux and hlsdemux as it is now in the base class
2015-02-17 11:12:41 -03:00
Thiago Santos
229a15b393 adaptivedemux: refactor chunk downloading flow
Add more power to the chunk_received function (renamed to data_received)
and also to the fragment_finish function.

The data_received function must parse/decrypt the data if necessary and
also push it using the new push_buffer function that is exposed now. The
default implementation gets data from the stream adapter (all available)
and pushes it.

The fragment_finish function must also advance the fragment. The default
implementation only advances the fragment.

This allows the subsegment handling in dashdemux to continuously download
the same file from the server instead of stopping at every subsegment
boundary and starting a new request
2015-01-19 15:30:04 -03:00
Vincent Penquerc'h
b5860af143 hlsdemux: a few leak fixes 2015-01-16 11:43:22 +00:00
Thiago Santos
dd7cb8f632 hlsdemux: implement _has_next_fragment to avoid busy looping
It will allow the demuxer to wait for a fragment to be available instead
of busy looping polling the playlist for a new fragment
2015-01-08 09:59:01 -03:00
Thomas Bluemel
cd6069f5af hlsdemux: Don't use approximate duration for fragment buffer pts
The duration values in playlists are approximate only, and for
playlist versions 2 and older they are only rounded integer values.
They cannot be used to timestamp buffers.  This resulted in playback
gaps and skips because the actual duration of fragments is slightly
different.  The solution is to only set the pts of the very first
buffer processed, not for each fragment.
2015-01-07 09:30:40 -03:00
Alex Ashley
50b5d94b2a hlsdemux: Implement live seeking
hlsdemux assumes that seeking is not allowed for live streams,
however seek is possible if there are sufficient fragments in the
manifest. For example the BBC have live streams that contain 2 hours
of fragments.

The seek code for both live and on-demand is common code. The
difference between them is that an offset has to be calculated
for the timecode of the first fragment in the live playlist.

When hlsdemux starts to play a live stream, the possible seek range
is between 0 and A seconds. After some time has passed, the beginning of
the stream will no longer be available in the playlist and the seek
range is between B and C seconds.

Seek range:
start          0 ........... A
later               B ........... C

This commit adds code to keep a note of the B and C values
and the highest sequence number it has seen. Every time it updates the
media playlist, it walks the list of fragments, seeing if there is a
fragment with sequence number > highest_seen_sequence. If so, the values
of B and C are updated. The value of B is used when timestamping
buffers.

It also makes sure the seek range is never closer than three fragments
from the end of the playlist - see 6.3.3. "Playing the Playlist file"
of the HLS draft.

https://bugzilla.gnome.org/show_bug.cgi?id=725435
2015-01-05 17:59:08 -03:00
Thiago Santos
104bd7cf02 hlsdemux: only typefind when we have a minimum amount of data
For small amounts some data might be mistyped and it would cause
the pipeline to fail. For example if you have AAC inside mpegts,
for small amounts, the AAC samples would cause the typefinder to
think it is AAC and not mpegts.

https://bugzilla.gnome.org/show_bug.cgi?id=736061
2014-12-30 08:35:21 -03:00
Vijay Jayaraman
68e77265a0 hlsdemux: typefind might fail if first buffer is too short
If typefind fails, check to see if the buffer is too short for typefind. If this is the case,
prepend the decrypted buffer to the pending buffer and try again the next time around.

https://bugzilla.gnome.org/show_bug.cgi?id=740458
2014-12-23 10:08:57 -03:00
Thiago Santos
1e9ce11efd hlsdemux: port to adaptive base class
Conflicts:
	ext/hls/gsthlsdemux.c
	ext/hls/gsthlsdemux.h
2014-12-23 10:08:57 -03:00
Tim-Philipp Müller
f216b7bb11 Sprinkle some G_PARAM_DEPRECATED and #ifndef GST_REMOVE_DEPRECATED 2014-11-02 17:19:34 +00:00
Tim-Philipp Müller
69ee564d5c hls: fix indentation 2014-11-02 17:17:46 +00:00
Matthieu Bouron
7fb584b087 hlsdemux: reset end_of_playlist attribute when we receive a seek
https://bugzilla.gnome.org/show_bug.cgi?id=738696
2014-10-21 12:55:42 +02:00
Thomas Bluemel
c87835a79f hlsdemux: Fix accessing invalidated memory
In gst_hls_demux_get_next_fragment() the next fragment URI gets
stored in next_fragment_uri, but the gst_hls_demux_updates_loop()
can at any time update the playlist, rendering this string invalid.
Therefore, any data (like key, iv, URIs) that is taken from a
GstM3U8Client needs to be copied. In addition, accessing the
internals of a GstM3U8Client requires locking.

https://bugzilla.gnome.org/show_bug.cgi?id=737793
2014-10-07 15:22:27 +03:00
Philippe Normand
6d67b5263f hlsdemux: lock client mutex before entering the retry_failover block
This is consistent with the case where the block execution is
triggered by the goto invoked after the current_variant update.

https://bugzilla.gnome.org/show_bug.cgi?id=736919
2014-09-18 23:28:15 +01:00
George Kiagiadakis
f4546b64ea hlsdemux: synchronize with the download loop thread to signal it to continue
If EOS or ERROR happens before the download loop thread has reached its
g_cond_wait() call, then the g_cond_signal doesn't have any effect and
the download loop thread stucks later.

https://bugzilla.gnome.org/show_bug.cgi?id=735663
2014-09-18 13:38:27 -03:00
Thiago Santos
07b59c93c2 hlsdemux: fix clearing of eos state in pads
The internal pad still keeps its EOS flag and event as it can be assigned
after the flush-start/stop pair is sent. The EOS is assigned from the streaming
thread so this is racy.

To be sure to clear it, it has to be done after setting the source to READY to
be sure that its streaming thread isn't running.

https://bugzilla.gnome.org/show_bug.cgi?id=736012
2014-09-18 12:14:30 -03:00
Sebastian Dröge
775c5600c9 hlsdemux: Also refetch the playlist after the first fragment failure
Previously we only refetched the playlist if downloading a fragment
has failed once. We should also do that if it failed a second or third time,
chances are that the playlist was updated now and contains new URIs.
2014-09-15 13:33:45 +03:00
Sebastian Dröge
d4a53a16dd hls: Actually retry 3 times as advertised instead of 2 2014-09-15 11:59:46 +03:00
Sebastian Dröge
f6c6d9c280 hlsdemux: Don't send flush events to deactivated pads
https://bugzilla.gnome.org/show_bug.cgi?id=736012
2014-09-04 18:20:58 +03:00
Thomas Bluemel
04ca723461 hlsdemux: Support OpenSSL for AES decryption of HLS fragments
https://bugzilla.gnome.org//show_bug.cgi?id=735248
2014-08-28 10:34:55 +03:00
Thibault Saunier
16201cec34 hlsdemux: Do not switch playlist on trick modes
Instead always use the low bandwith playlist making things go smoother
as the current heuristic is rather set for normal playback, and
currently it does not behave properly.

https://bugzilla.gnome.org/show_bug.cgi?id=734445
2014-08-13 17:49:12 +02:00
Thibault Saunier
123953d429 hlsdemux: No need to have a I-Frame list to do trick modes
It just works cleanly without any index and there is no real reason for
that limitation. Also, there are very few stream with that feature.

https://bugzilla.gnome.org/show_bug.cgi?id=734445
2014-08-13 17:49:05 +02:00
Sebastian Dröge
429f20531f hlsdemux: Make statistics message more generic for other adaptive streaming demuxers to reuse
https://bugzilla.gnome.org/show_bug.cgi?id=725828
2014-07-21 09:37:51 +02:00
Alexander Zallesov
7f4f9f09e3 hlsdemux: Provide statistics about time to download playlists and fragments
https://bugzilla.gnome.org/show_bug.cgi?id=725828
2014-07-21 09:37:51 +02:00
Thomas Bluemel
b1fac8c781 hlsdemux: Fix decrypting fragments
Only reset the decryption engine on the first buffer of a fragment,
not again for the second buffer.  This fixes corrupting the second
buffer of a fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=731968
2014-06-22 14:21:35 +02:00
Sebastian Dröge
95404609c0 hlsdemux: Include the debug string in the error messages we propagate from the
source
2014-06-19 18:34:05 +02:00
Sebastian Dröge
48987fd5a1 hlsdemux: Include a more descriptive error message 2014-06-19 18:34:05 +02:00
Sebastian Dröge
1e795ccce1 hlsdemux: Propagate error messages from the source element up in the hierarchy
Instead of inventing our own generic error strings which are mostly useless.
2014-06-19 18:34:05 +02:00
Sebastian Dröge
213883eb51 hlsdemux: Directly convert GErrors to error messages
This will make sure that we don't leak debug information into the actual
error message string and keep it behind the debug string.
2014-06-19 18:34:05 +02:00
Thomas Bluemel
babd8969f2 hlsdemux: Reload the variant playlist if refreshing a playlist or downloading a fragment fails
This can happen if the playlists have moved due to the variant playlist
now being redirected to another target. This currently only works as long
as the referenced playlists don't change in relation to the variant
playlist, and the new location is purely due to a new path triggered by a
new redirection target of the variant playlist, or a new redirection
target of the playlist itself.

https://bugzilla.gnome.org/show_bug.cgi?id=731164
2014-06-06 13:02:47 +03:00
Sebastian Dröge
9cb3d745db hlsdemux: Don't set base URI if there was no redirect 2014-05-28 12:47:22 +02:00
Sebastian Dröge
2f39a3d711 hlsdemux: Always use the redirect target to resolve relative URIs
But redownload the playlists from the original URI if it's not
a permanent redirect.
2014-05-28 10:19:40 +02:00
Thiago Santos
7dfd308e8c hlsdemux: fix internal source event leaks 2014-05-06 19:24:55 -03:00
Thiago Santos
b891bd04d5 hlsdemux: Only set the segment position if there is a timestamp
Only the first buffer of a fragment has its timestamp set, so only
update the segment.position when pushing those buffers to avoid
having GST_CLOCK_TIME_NONE set to the position

https://bugzilla.gnome.org/show_bug.cgi?id=729364
2014-05-05 11:35:35 -03:00
Sebastian Dröge
0ce2b0632e hlsdemux: Set Cache-Control header according to the caching requirements of the playlist 2014-05-05 09:46:06 +02:00
Sebastian Dröge
1aacd0a963 hlsdemux: Update for URI downloader API changes
And make sure to set refresh=TRUE when updating the playlist.
2014-05-02 10:44:41 +02:00
Sebastian Dröge
9c7da93b9d hlsdemux: Always succeed the LATENCY event
Upstream and our internal source is irrelevant for the latency
and we don't want the LATENCY event to ever fail.
2014-05-01 16:18:37 +02:00
Sebastian Dröge
126891e9a5 hlsdemux: Reset the last flow return before restarting the internal source
Otherwise we will never recover from previous errors, and especially
will never start again after a flushing seek if downstream returned
GST_FLOW_FLUSHING to us.
2014-05-01 16:18:37 +02:00
Sebastian Dröge
0d5dcba778 hlsdemux: Only set PTS on the first buffer of a fragment instead of setting the same on all of them 2014-05-01 16:18:37 +02:00
Thiago Santos
aea14053d1 hlsdemux: Always flush the internal proxy pads before downloading
hlsdemux can't rely on the source to push flushes on a seek on ready
as that might not make sense. So always resort to flushing the
internal proxy pads by pushing flush events from the source's src pad.

Also as the seeking is not required anymore, only seek if there is
really a byte range to be used. And store a ref to the source's
src pad to avoid doing get_static_pad for every fragment.
2014-05-01 16:18:16 +02:00
Sebastian Dröge
fc38c22f1b hlsdemux: Only unref pending buffer if there is one 2014-04-30 10:14:12 +02:00
Thiago Santos
940576244c hlsdemux: Do not push last buffer after error
In decryption scenario, a buffer is always stored to be sent later
to wait for more data or EOS to be able to strip the final bytes
if requested. In case an error hapenned this buffer can be ignored
and not pushed downstream.
2014-04-29 18:49:15 -03:00
Thiago Santos
bb8887baa7 hlsdemux: flush the adapter in the end of a fragment
In case of error there might be some data left in the
adapter when EOS is received. Clear the adapter to be
able to restart again later if requested.
2014-04-29 18:49:15 -03:00
Thiago Santos
4ab1d9f21f hlsdemux: handle more error cases
Handle some more error cases:

1) When the source element fails to go to ready
2) When decryption fails
3) When there is no source to handle a specific URI
4) When the URI is invalid
2014-04-29 18:49:15 -03:00
Thiago Santos
4431388cab hlsdemux: handle errors from internal source
Set up a message handling function to catch errors from the internal
source and store the last return code to identify error situations
when returning from a fragment download.

Also moves the duration increase to after the download when we
know if it was successful or not
2014-04-29 18:49:15 -03:00
Thiago Santos
f16560c520 hlsdemux: Improve pad switching conditions
When using the internal source, hlsdemux doesn't know the caps of
the input before adding the pad, so remove the arguments that would
use that as it is always NULL.

And use an specific flag to signal when a pad switch is required.
Using the discont flag is a bad idea now because when a fragment
download fails it will lead to exposing a pad group without any
data, causing decodebin to abort.
2014-04-29 18:49:15 -03:00
Thiago Santos
587851ba10 hlsdemux: properly flush decryption status on seeks
Avoids mixing decryption of different fragments when seeking happens
and leading to broken stream output.
2014-04-29 18:49:15 -03:00
Thiago Santos
ff395a7565 hlsdemux: Track fragments duration
When receving EOS from the internal src, increase the current positon
by the fragment duration to allow correct restoring of download position
if the bitrate changes
2014-04-29 18:49:15 -03:00
Thiago Santos
2b73e86881 hlsdemux: properly stop tasks by stopping fragment download
Issue a signal to the fragment download cond to stop
the task earlier
2014-04-29 18:49:15 -03:00
Thiago Santos
60eec1443a hlsdemux: decrypt before typefinding
Make sure typefinding gets the decrypted content instead of
trying to typefind the encrypted data.
2014-04-29 18:49:15 -03:00
Thiago Santos
cc262b0923 hlsdemux: fix decryption function return
Correctly return the decrypted buffer when it succeeds and
return NULL otherwise
2014-04-29 18:49:15 -03:00
Thiago Santos
f6b0cae8b6 hlsdemux: keep connection alive between downloads
Use the same properties as uridownloader to keep connections alive
between consecutive fragments downloads.

1) set keep-alive property to true
2) keep the element in READY instead of in NULL
2014-04-29 18:17:07 -03:00
Thiago Santos
4b9d91d497 hlsdemux: create sources from uri
Instead of using always an http source, create it dynamically from
uri when needed. If not needed just replace the URI on the current
element
2014-04-29 18:17:07 -03:00
Thiago Santos
671f8c0e35 hlsdemux: do not try to run typefind again if caps is the same
Always reset the do_typefind flag if hls did typefind because
trying it on non-zero offsets doesn't make sense and will cause
assertions
2014-04-29 18:17:07 -03:00
Thiago Santos
cc033c7ca0 hlsdemux: enable download bitrate measure
Measure the download bitrate to be able to select
the best playlist.

As the buffers are directly pushed downstream and it
might block. The time is only measured from the download
until the pad push and it is started again after the push
returns.
2014-04-29 18:17:07 -03:00
Thiago Santos
c93c222786 hlsdemux: re-enable decryption after uridownloader removal
Now the decryption is done buffer by buffer instead of on the
whole fragment at once. As it expects multiples of 16 bytes a
GstAdapter was added to properly chunk the buffers.

Also the last buffer must be resized depending on the value of the
last byte of the fragment, so hlsdemux always keeps a pending buffer
as it doesn't know if it is the last one yet
2014-04-29 18:17:07 -03:00
Thiago Santos
3611759557 hlsdemux: replace uridownloader with a GstElement
The GstElement is directly linked into a ghost pad and
its buffers are pushed as received downstream. This way the
buffers are small enough and not a whole fragment that usually
causes extra latency and makes buffering harder
2014-04-29 18:17:07 -03:00
Sebastian Dröge
b47c92df82 hlsdemux: Set Referer in requests to the playlist URI 2014-04-28 10:04:28 +02:00
Tim-Philipp Müller
dbe6fdd6bf docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-27 00:36:32 +01:00
Sebastian Dröge
f82d9ec4a9 hlsdemux: Also update the sequence position when updating non-live playlists 2014-04-10 16:53:42 +02:00
Sebastian Dröge
a06d4ea408 hlsdemux: Try reloading the playlist first if downloading a fragment fails
But only add this for non-live playlists. For live playlists we already
have another thread that is periodically updating playlists.

Reason for this is that sometimes downloading a fragment can fail because
the URIs have changed or expired since last time.
2014-04-10 15:06:53 +02:00