Commit graph

62 commits

Author SHA1 Message Date
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
Sebastian Dröge
864399f299 hlsdemux: When updating a non-live playlist make sure to find the current sequence by time
Sequence numbers in different playlists are not guaranteed to be the same for the
same position, e.g. fragments could have different durations in different playlists.

In theory we should do exactly the same for live playlists, but unfortunately we can't
because doing this kind of seeking requires the complete playlist since we started
playback. For live playlists the server is however dropping fragments in the beginning
over time and we have no absolute time references.
2014-04-10 15:06:53 +02:00
Vincent Penquerc'h
c319b1cc8f hls: only set DISCONT flag on a valid buffer
Recent refactoring causes this code to be called with either a NULL
fragment, or a non NULL fragment. In the former case, we don't have
a buffer. In the latter case, the original code dealing with DISCONT
assumed the buffer was valid. Testing for a NULL buffer here thus
does not seem to change the intent, and fixes:

Coverity 1195147
2014-04-08 16:56:04 +01:00
Sebastian Dröge
b86e502a8b hlsdemux: Handle errors when switching playlists properly 2014-03-30 19:22:25 +02:00
Sebastian Dröge
89ca4535eb hlsdemux: Go EOS if the end of the segment is reached 2014-03-30 19:22:25 +02:00
Sebastian Dröge
911023eb88 hlsdemux: Store buffer end position in segment.position 2014-03-30 19:22:24 +02:00
Sebastian Dröge
f701755b83 hlsdemux: Don't set the segment offset
It's causing wrong running times after seeks or bitrate
switches.
2014-03-29 10:33:45 +01:00
Sebastian Dröge
e11a99e26a hlsdemux: Set DISCONT flag on all buffers in reverse playback mode 2014-03-29 10:33:45 +01:00
Sebastian Dröge
6039734f3e hlsdemux: Unset DTS of all buffers
We won't get a valid DTS from the source.
2014-03-29 10:33:45 +01:00
Sebastian Dröge
cad284e843 hlsdemux: Send flush start event before waiting for the tasks to finish
Otherwise we'll wait until buffers are completely processed downstream,
which might take quite some time.
2014-03-29 10:33:45 +01:00
Sebastian Dröge
91ec00a0c0 hlsdemux: Implement trick modes via I-frame variant lists 2014-03-29 10:33:45 +01:00
Sebastian Dröge
7ddd67baef hlsdemux: Always calculate the current download rate
Also take into account the last download rate when
calculating it.
2014-03-12 12:35:22 +01:00
Sebastian Dröge
d2880dce68 hlsdemux: Implement proper segment handling
https://bugzilla.gnome.org/show_bug.cgi?id=695846
https://bugzilla.gnome.org/show_bug.cgi?id=723268
2014-03-06 23:16:56 +01:00
Sebastian Dröge
cd02546089 hlsdemux: Implement handling of byte ranges 2014-03-06 16:36:10 +01:00
Zallesov
7ed08a1326 hlsdemux: Fix seeking further than track duration
Don't fail the seek but instead send an EOS event from the streaming thread.
2014-03-06 09:39:22 +01:00
Sebastian Dröge
5d5ca5139e hlsdemux: Switch playlists after pushing the fragment
Makes sure we properly set the discont flag for the next buffer,
not the current one.
2014-03-05 20:44:02 +01:00
Sebastian Dröge
0a32c5f7a4 hlsdemux: Implement proper handling of discontinuities
It's not really correct yet for seeks but better than what
we had before.

See https://bugzilla.gnome.org/show_bug.cgi?id=695846
2014-03-01 17:15:54 +01:00
Sebastian Dröge
874af7db4e hlsdemux: Init and clear a mutex
GLib initialises automatically for us for some reason... but of course
does not clear the mutex once the demuxer is destroyed.
2014-02-27 15:50:12 +01:00
Sebastian Dröge
5f0a5c3594 hlsdemux: Unref seek events before returning from the seek handler
Otherwise we leak them all.
2014-02-27 15:41:30 +01:00
Sebastian Dröge
b3a7242910 hlsdemux: Keep track of timestamps by adding them up during playback
...instead of adding them from the start of playlist every time. This
among other things fixes timestamps for live streams, where the playlist
is some kind of ringbuffer of fragments and thus adding from the beginning
of the playlist will miss the past fragments.

https://bugzilla.gnome.org/show_bug.cgi?id=724983
2014-02-23 15:18:22 +01:00
Sebastian Dröge
090bf91974 hlsdemux: Deprecate fragments-cache property
The buffering/caching is handling completely different now and
outside of hlsdemux.
2014-02-23 11:01:57 +01:00
Sebastian Dröge
b47a4faf5f ext: Use Codec/Demuxer/Adaptive for the adaptive streaming demuxers 2014-02-23 00:11:04 +01:00
Sebastian Dröge
a51116add3 hlsdemux: Refactor threading and downloading
We now download fragments as fast as possible and push them downstream
while another thread is just responsible for updating live playlists
every now and then.

This simplifies the code a lot and together with the new buffering
mode for adaptive streams in multiqueue makes streams start much faster.

Also simplify threading a bit and hopefully make the GstTask usage safer.
2014-02-23 00:10:45 +01:00
Sebastian Dröge
76e74547c7 hlsdemux: Only switch pads if the caps are changing 2014-02-23 00:10:45 +01:00
Andoni Morales Alastruey
99feef2d08 hlsdemux: fix update interval with respect of the spec 2014-02-14 13:07:39 +01:00
Sebastian Dröge
13997abbf9 hlsdemux: Give a proper name to the srcpads and remove it when resetting the element 2014-02-12 18:27:21 +01:00
Sebastian Dröge
adea24cdf8 hlsdemux: Stop leaking GErrors in some error paths 2014-02-12 16:46:31 +01:00
Gil Pedersen
62ddd34807 hlsdemux: don't pause task when it is stopped
This fixes a potential dead-lock situation from GstTask

https://bugzilla.gnome.org/show_bug.cgi?id=675869
2014-02-12 16:04:52 +01:00
Sebastian Dröge
281f2f3590 hlsdemux: Wait for the update task to finish when shutting down 2014-02-12 16:01:05 +01:00
Sebastian Dröge
4dcacc1773 hlsdemux: Prevent rounding errors due to division by using gst_util_uint64_scale() 2014-02-12 15:33:06 +01:00
Arnaud Vrac
6e54b8ee53 hlsdemux: schedule next update based on the fragment duration 2014-02-12 15:18:29 +01:00
Sebastian Dröge
05efcbf757 hlsdemux: Properly error out if caps can't be typefind instead of using NULL caps 2014-02-12 15:16:23 +01:00
Arnaud Vrac
63e18bb7bf hlsdemux: log fragment timestamp 2014-02-12 14:39:15 +01:00
Sebastian Dröge
a84220a658 hlsdemux: Error out if the key is not 16 bytes large 2014-02-12 13:40:41 +01:00
Sebastian Dröge
8c3ef21a68 hlsdemux: Download playlists with compression, keys and fragments without 2014-02-12 13:13:30 +01:00
Sebastian Dröge
245a7d94f5 hlsdemux: Don't set the element private data on the srcpads
It's not used anyway.
2014-02-12 11:26:04 +01:00
Sebastian Dröge
60f1dadd1c hlsdemux: Use gst_pad_use_fixed_caps() on the srcpads 2014-02-12 11:25:41 +01:00
Sebastian Dröge
bc42a18f92 hlsdemux: Cache the key fragment instead of downloading it over and over again 2014-02-12 10:59:38 +01:00
Sebastian Dröge
792d1e0109 hlsdemux: Fix cleanup when decryption fails
First unmap buffers, then unref them. And also unref the
key fragment.
2014-02-12 10:58:45 +01:00
Sebastian Dröge
591598da48 hlsdemux: Propagate download errors properly and post error messages if they're fatal 2014-02-11 14:57:16 +01:00
Sebastian Dröge
3a5abc233d ext: Update for GstUriDownloader API changes 2014-02-11 14:18:32 +01:00
Sebastian Dröge
73d9a8b0c9 hlsdemux: Start downloading the next fragment immediately after caching the initial fragments
And only afterwards wait until a fragment was played. Otherwise we're keeping
our cache most of the time at "fragments-cache" fragments minus one.

Also allow setting "fragments-cache" to 1 now to start playback even faster.
2014-02-10 18:30:21 +01:00
Sebastian Dröge
4f04f3e68e hlsdemux: Start fetching new fragments whenever we have less fragments cached than given by the fragments-cache property
Waiting until our cache is empty before starting to fetch the next fragment
kind of defeats the purpose of caching multiple fragments.
2014-02-10 18:27:58 +01:00
Sebastian Dröge
89c592ccdd hlsdemux: Fix bitrate calculation
g_get_monotonic_time() returns microseconds, not nanoseconds.
2014-02-10 18:21:38 +01:00