Jan Schmidt
61516eadf6
hlsdemux2: Ignore partial segments when not live
...
Add some checks that LL-HLS support is enabled and that the current playlist is
live before proceeding to play any partial segments.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
401ca3ef44
hlsdemux2: Print playlist age in debug output
...
Store the timestamp when playlists are updated, and add some debug output to the
update_fragment_info that estimates how far from the live edge the fragment
currently is
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
43e042c4b7
hlsdemux2: Implement LL-HLS flag and part-hold-back/hold-back in live.
...
Add a flag to hlsdemux to enable or disable LL-HLS handling.
When LL-HLS is enabled and an LL-HLS playlist is loaded, use the part-hold-back
threshold to choose a starting segment.
For live streams that aren't LL-HLS, use the provided hold-back attribute, or
fall back to landing 3 segments from the end.
Make the gst_hls_media_playlist_seek() method able to choose a partial segment
within 2 target durations of the end of the playlist when requested.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:22 +00:00
Jan Schmidt
9848c1a1a1
m3u8demux2: Fix off-by-one and leak.
...
Fix an off-by-one in gst_hls_media_playlist_sync_to_playlist() that would ignore
the first fragment in the reference playlist. The error was harmless, since we
expect the reference playlist to be older than the playlist we're
synchronising (so the first/oldest segment in the reference playlist will likely
not exist in the new playlist), so this is just for correctness.
Also fix a segment leak in gst_hls_media_playlist_advance_fragment() when
ignoring the partial_only segment.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
676fffd23c
hlsdemux2: Fix segment advance on partial segments.
...
Fix the duration passed to gst_adaptive_demux2_stream_advance_fragment() when
advancing from a partial segment.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
e318bc3df5
hlsdemux2: Improve some debug output
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
3537614c2b
hlsdemux2: Add and use gst_hls_media_playlist_find_position()
...
Add a function for synchronising current position with the contents of a
playlist that is specifically for that and can handle synchronising to a partial
segment.
gst_hls_media_playlist_seek() will be used only when performing external seek
requests, to find the best segment or partial segment at which to resume
playback.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
c25814bac0
hlsdemux2: Add debug in find_segment_in_playlist()
...
In m3u8 segment matching, print the PDT that was matched between playlists.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
857541ae07
hlsdemux2: Fix some m3u8 segment leaks
...
Make sure unref m3u8 segments in some missed paths.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
7b9547a119
hlsdemux2: Allow starting at the partial_only segment
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
1b8af98208
hlsdemux2: Recalculate partial segments in anchor segment
...
When recalculating the partial segment stream times in
gst_hls_media_playlist_recalculate_stream_time(), don't miss the anchor segment
itself.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
e1a6ec22ee
hlsdemux2: Dump init uri details for segments.
...
When dumping an m3u8 playlist to debug, include information about any
initialisation data.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
2c82fdf276
hlsdemux2: Use gst_hls_media_playlist_recalculate_stream_time()
...
Instead of recalculating stream times manually in a playlist, let the playlist
do it, so that it fixes up partial segment stream times too.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
d76aacfb82
hlsdemux2: LL-HLS improvements
...
Fixes for stream_time recalculation and handling in partial segments.
Disallow bitrate switching when in the middle of partial segments - only at a
full segment (or right before the first partial segment of a segment).
It's possible but more difficult to switch bitrates in the middle of a partial
segment group, since they are less likely to have aligned keyframes. In any
case, the seek code can't do that right now.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
b6abe94890
hlsdemux2: Continue implementing LL-HLS support
...
Somewhat working support for proceeding into the partial segments appearing at
the live edge of the playlist.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
92e849070f
hlsdemux2: Mark locations where partial segments need handling
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
cfc62a69f7
hlsdemux2: Start adding partial_segment handling
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
9aa2497062
hlsdemux2: Note STABLE-RENDITION-ID is not handled
...
Add a comment that STABLE-RENDITION-ID is not yet parsed or used.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
e2750d4ae3
hlsdemux2: Calculate stream times for partial segments
...
When calculating stream times for segments, fill in the stream time fields on
any attached partial segments
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
3c50f54310
hlsdemux2: Implement preload hint parsing
...
Load EXT-X-PRELOAD-HINT into a preload_hints array in the media playlist
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
3ed6a23a4d
hlsdemux2: Implement EXT-X-SERVER-CONTROL parsing
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
07f51396af
hlsdemux2: Add parsing of partial segments
...
Add partial segments to each media segment, and potentially create a trailing
dummy segment if there are partial segments at the end of the playlist
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Jan Schmidt
fac7177354
hlsdemux2: make helper function for parsing times
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Edward Hervey
4e946890b2
adaptivedemux2: Global output position is always positive
...
Change to non-signed GstClockTime for tracking
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883 >
2023-02-03 16:52:21 +00:00
Thibault Saunier
6b30a5d987
adaptivedemux2: Generate proper stream-id taking into account upstream
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3160 >
2023-02-01 22:26:34 +00:00
Tim-Philipp Müller
9a235838c8
adaptivedemux2: drop use of GSlice
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695 >
2023-01-24 15:25:06 +00:00
Jan Schmidt
023c67e166
hlsdemux: Consider starting stream time in presentation offset
...
When calculating the presentation offset for CMAF input in live
playback, subtract the stream_time of the fragment from the
calculated presentation offset, so that the first fragment
is played at running time zero.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3680 >
2023-01-05 07:08:16 +00:00
Edward Hervey
63b598b409
adaptivedemux2: Don't allow stream selection while switching periods
...
The stream selection is done on the currently outputting tracks, but in order to
(de)activate the backing streams we can only do it if the input and output
period are identical.
Fixes crash when doing stream selection during period migration
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3525 >
2022-12-05 11:03:26 +00:00
Jan Schmidt
843f10f7f9
adaptivedemux2: Add GStreamer to the deps list
...
Explicitly dep on GStreamer so as not to accidentally
link to the system version in a git build
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3453 >
2022-11-23 09:29:14 +00:00
Edward Hervey
f9dbf91539
adaptivedemux2: Don't leak caps in debug statements
...
Instead just directly use the stream object (which will report the caps)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3443 >
2022-11-21 19:02:44 +00:00
Edward Hervey
a742c3bf27
adaptivedemux2: Don't leak tags
...
If we got them from GstStream, we should unref them when done
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3443 >
2022-11-21 19:02:44 +00:00
Edward Hervey
e36b1ae6ed
adaptivedemux: Use gst_clear_tag_list_where applicable
...
Clearer and ensures fields are reset
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3443 >
2022-11-21 19:02:44 +00:00
Jan Schmidt
8b08305ef9
adaptivedemux2: Fix sticky event storage.
...
Use the new gst_event_type_to_sticky_ordering() method to retrieve
the order that sticky events should be sent / stored in, instead
of assuming it's the event type value.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3387 >
2022-11-21 10:32:02 +00:00
Enrique Ocaña González
aafe07a802
hlsdemux2: Expose EXT-X-PROGRAM-DATE-TIME as tags.
...
This allows an application to use timestamps associated
with fragments.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1417 >
2022-11-17 22:11:12 +00:00
Edward Hervey
e68baffcd9
adaptivedemux2: Notify that we are streams-aware
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784 >
2022-11-16 14:01:46 +00:00
Rafał Dzięgiel
30c2bdad61
mpdparser: Fix missing baseURL query
...
When no initializationURL or mediaURL, return baseURL that also
contains original URI query if available. This fixes a problem
where URI query was being omitted in the HTTP requests.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1147 >
2022-11-14 23:45:53 +00:00
Rafał Dzięgiel
548bbc3147
mpdparser: Be consistent about returning duplicated URL
...
Instead of returning a "const gchar" or a "gchar" that should not be freed, always
return a duplicated string as those functions were used together with g_strdup anyway.
This is needed to prepare support for returning modified strings in next commit.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1147 >
2022-11-14 23:45:53 +00:00
Rafał Dzięgiel
0d79dbedf3
mpdparser: Return correct mediaURL value
...
This fixes a problem where get_mediaURL was returning NULL when segmentURL
was unavailable instead of baseURL as a fallback.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1147 >
2022-11-14 23:45:53 +00:00
Rafał Dzięgiel
9e74c728cb
adaptivedemux2: Fix parent object leak
...
gst_object_get_parent() method is transfer-full, thus unref is needed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3396 >
2022-11-13 11:35:09 +00:00
Edward Hervey
7f86e925e2
adaptivedemux2: Fix collection leaks
...
* The collection on the period was never unreffed
* The collection in the message handler was never unreffed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3319 >
2022-11-04 17:59:21 +00:00
Jan Schmidt
b2f2a9125c
mssdemux2: Update for adaptivedemux2 refactoring
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 04:00:31 +11:00
Jan Schmidt
565f47b4f3
adaptivedemux2: Move stream_seek() to the Stream class
...
Move the last stream specific vfunc from the demux
class to the stream class.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 04:00:31 +11:00
Jan Schmidt
2fe641353d
adaptivedemux2: Refactor stream methods into the stream
...
Unlike the legacy elements, GstAdaptiveDemuxStream is a GObject now,
so a bunch of things that were actually stream methods on the
parent demux object can directly become stream methods now.
Move the stream class out to a header of its own.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 04:00:31 +11:00
Jan Schmidt
9f89b8e3ef
hlsdemux2/m3u8: Implement EXT-X-GAP parsing
...
Read the EXT-X-GAP tag and set is_gap on the segment.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 03:24:27 +11:00
Jan Schmidt
55db033570
hlsdemux2/m3u8: Refactor parsing for readability
...
Small readability improvements in the parsing code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 03:24:27 +11:00
Jan Schmidt
bfeb3c5625
adaptivedemux2/downloadhelper: Remove return val for download_request_add_buffer()
...
The function can't actually fail, and the only caller
was ignoring the result anyway, so remove the return value.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 03:24:27 +11:00
Jan Schmidt
0f8c38c190
adaptivedemux2/downloadhelper: Add debug output of response headers
...
Dump the HTTP response headers at TRACE level
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 03:24:27 +11:00
Jan Schmidt
d1ae35f08a
adaptivedemux2/downloadhelper: Don't mark transfer as complete/error if cancelled.
...
If the state of the download request was reset to UNSENT,
it was cancelled. Don't update the state to COMPLETE or ERRORED
in on_read_ready().
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 03:24:26 +11:00
Jan Schmidt
46517d5aca
adaptivedemux2/downloadhelper: Ignore spurious read failure
...
Sometimes g_input_stream_read_all_finish() can return
0 bytes, but still succeed (return TRUE) and have more
data available later. Only finish the transfer
if it returns 0 bytes *and* FALSE with no error.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 03:24:26 +11:00
Jan Schmidt
1751f555f2
adaptivedemux2/downloadhelper: Fix function name
...
Fix a typo in the name of function download_request_despatch_progress()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3314 >
2022-11-05 03:24:26 +11:00