Commit graph

209 commits

Author SHA1 Message Date
Florin Apostol
eab158a669 adaptivedemux: fixed multithread support
https://bugzilla.gnome.org/show_bug.cgi?id=755169
2015-10-29 10:20:45 +00:00
André Draszik
e0b4290998 hlsdemux: don't crash or leak memory on broken master playlist
If a (master) playlist contains a variant list entry without a
URI then during parsing of the next variant list entry we are
a) leaking the entry we're currently parsing (new_list), and
b) free'ing the pointer to the previous list entry (list) without
   updating the pointer.

Hence when then adding the URI for the latest parsed entry, incorrect
information is stored, as the information is used from 'list' which
is not valid memory anymore, also leading to crashes.

Fix this by correctly storing the new variant list entry pointer
as needed.

https://bugzilla.gnome.org/show_bug.cgi?id=756861
2015-10-25 09:26:34 +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
Tim-Philipp Müller
1c8d844ece hlsdemux: m3u8: move file lookup by sequence directly into code
Nicer to read, two lines of code less, and also the callback
function should've been a GCompareFunc that returns a gint
and not a boolean (it did work correctly, was just confusing).
2015-10-23 18:20:01 +01:00
Tim-Philipp Müller
28ac033773 hlsdemux: m3u8: clean-up: remove unused argument in function call 2015-10-23 18:19:55 +01:00
Tim-Philipp Müller
da682fc130 hlsdemux: m3u8: clean-up: reindent header for better readability
And remove duplicate define.
2015-10-23 18:19:49 +01:00
Edward Hervey
f7c4bb5ac6 hls/m3u8: Update current position in all cases
In order to ensure the sequence_position will always be consistently updated,
store the current file duration.

This way, when we advance, we can always increment the position based on what
was previously outputted.

https://bugzilla.gnome.org/show_bug.cgi?id=752132
2015-10-19 14:45:42 +02:00
Thiago Santos
d5f79b8529 hls: if media sequence is not specified, use 0
Allows playlists that are missing the mediasequence information to
be correctly parsed. If the playlist was updated without reseting
the mediasequence it would constantly increase over subsequent updates,
leading to issues during playback.
2015-10-14 21:33:27 -03:00
Edward Hervey
0e663fca94 hls: Allow debugging of the playlist
Helps debugging issues
2015-10-14 18:01:04 +02: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
Sebastian Dröge
f5dd41d710 Update GLib dependency to 2.40.0 2015-10-02 22:24:19 +03:00
Tim-Philipp Müller
cec0ef105f hls: m3u8playlist: more clean-ups
Remove unused functions; move GstM3U8 struct into .c file,
and indent the header so it's nice to read.
2015-09-30 00:43:26 +01:00
Tim-Philipp Müller
cae2fa0cef hls: m3u8playlist: fix silly queue iteration code 2015-09-30 00:43:26 +01:00
Tim-Philipp Müller
4a9a0da50f hls: m3u8playlist: more minor playlist_render() clean-ups
Move the TAG defines directly into the code, not sure what
their purposes is, these are printf format strings so having
them directly as literals in the code where they're used
makes the code easier to follow.
2015-09-30 00:43:26 +01:00
Tim-Philipp Müller
386f173eaf hls: m3u8playlist: move entry rendering into render_playlist()
Makes the code easier to follow and avoids unnecessary temporary
strings, since we can just append to the playlist GString directly.
2015-09-30 00:43:26 +01:00
Tim-Philipp Müller
54e1753da4 hls: m3u8playlist: simplify gst_m3u8_playlist_render()
Remove playlist_str GString variable from GstM3U8Playlist struct,
since it's only used temporarily in playlist_render(). Might just
as well keep it local then.
2015-09-30 00:43:26 +01:00
Tim-Philipp Müller
019cdea1bd hls: remove unused macro and direct gio usage 2015-09-30 00:43:26 +01: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
Tim-Philipp Müller
536e3742aa Fix file permissions of some files 2015-08-28 19:55:59 +01:00
Athanasios Oikonomou
22456ce032 hlsdemux: select correct position for live streams that don't remove fragments
Some live streams (eg youtube) don't remove fragments in order to allow
seeking back in time (live + vod).

When gst_m3u8_client_has_next_fragment is called, we are getting wrong fragment
because current_file points in first file of the fragments list resulting in
watching the stream from the beginning again.

This patch sets current_file to nth fragment for live streams, then on
gst_m3u8_client_has_next_fragment will keep up with the live stream.

https://bugzilla.gnome.org/show_bug.cgi?id=753344
2015-08-26 12:11:57 +03: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
Thiago Santos
bc33d22635 hlsdemux: don't warn about duration if it is not known
And also print the values in case of warning
2015-08-07 11:24:52 -03:00
Thiago Santos
2ed8a819f6 hlsdemux: demote error to warning
It is not fatal and can be quite normal when the network is
too slow
2015-07-24 10:09:19 -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
Edward Hervey
04b010a883 hlsdemux: Search more when advancing fragment
In live situations, it is not uncommon for the current fragment to end
up out of the (updated) play range (lowest/highest sequence). But the next
fragment to play *is* present in the play range.

When advancing, if we can't find the current GstM3U8MediaFile, don't abort
straight away. Instead, look if a GstM3U8MediaFile with the next sequence value
is present, and if so switch to it.

https://bugzilla.gnome.org/show_bug.cgi?id=750028
2015-05-28 14:56:36 +02: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
Tim-Philipp Müller
699452ef31 Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 18:59:32 +01: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
5fd2fc3050 hlsdemux: Don't error out if we can't match variant playlists after updating
It's better to just select some random variant playlist instead of stopping,
chances are that it's still continuing to work and we might just have to
select a different variant again later.
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
75c9a5f129 hlssink: write the playlist end marker on EOS
Catch EOS from the multifilesink and add the endlist marker to
the playlist when it happens

https://bugzilla.gnome.org/show_bug.cgi?id=747319
2015-04-04 11:00:10 -03:00
Thiago Santos
f00aec48fa hlssink: implement a chain_list to request key unit for segments
upstream might send buffer lists instead of buffers and hlssink's
probe won't get called and a new segment won't be created when needed.

This patch fixes it by adding a chain_list function to the sink pad
that will just pass through the whole bufferlist if no segment needs
to be requested at the moment or convert the list into buffers to
check the proper timestamp to request the next key-unit that will
start the segment.

https://bugzilla.gnome.org/show_bug.cgi?id=746906
2015-03-30 12:31:08 -03: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
Alex Ashley
a08dd85608 hlsdemux: select correct starting position for live streams
When playing live HLS streams, the media playback starts from the
beginning of the media playlist. When playing a live HLS stream,
media playback should start from 3 fragments from the end of the
playlist.

See section 6.3.3. of the HLS draft [1]

This commit changes the logic to select 3 fragments from the end when
playing a live stream.

[1] http://tools.ietf.org/html/draft-pantos-http-live-streaming-12#page-29

https://bugzilla.gnome.org/show_bug.cgi?id=727742
2015-02-20 19:00:01 -03:00
Guillaume Seguin
b75f64d72e hlssink: reduce playlist's EXT-X-VERSION to 3
We are not using any features greater than the 3rd version,
so reduce to what we actually use to make it compatible with
more players

https://bugzilla.gnome.org/show_bug.cgi?id=744689
2015-02-19 12:17:21 -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
00bdac51a3 hlssink: allow creation of 'infinite' playlist
Allow the playlist-length to accept '0' as a value, indicating
that no segment should be removed from the playlist. This allows
generating playlists to be used as VOD when complete.
2015-02-17 11:12:42 -03:00
Thiago Santos
6ec5904d46 hlssink: remove unused attribute
the GFile attribute is never used
2015-02-17 11:12:41 -03:00