mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 21:16:24 +00:00
hlsdemux2: Fix missed segment match for partial-only segment
Fix a case where the matching code might not select the final partial-only segment because it has too short a duration (while it's still being created) Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3883>
This commit is contained in:
parent
9edb2f6690
commit
90bedcb2bc
1 changed files with 8 additions and 3 deletions
|
@ -1526,9 +1526,14 @@ gst_hls_media_playlist_find_position (GstHLSMediaPlaylist * playlist,
|
|||
}
|
||||
|
||||
/* Otherwise, we're doing a full segment match so check that the timestamp is
|
||||
* within half a segment duration of this segment stream_time */
|
||||
if (cand->stream_time + (cand->duration / 2) >= ts &&
|
||||
cand->stream_time <= ts + (cand->duration / 2)) {
|
||||
* within half a segment duration of this segment stream_time. The maximum
|
||||
* of the current segment or target duration is used, because the partial-only
|
||||
* last segment might be quite small (as it's still being created), which
|
||||
* can cause a missed match otherwise */
|
||||
GstClockTimeDiff match_threshold =
|
||||
MAX (cand->duration, playlist->targetduration) / 2;
|
||||
if (cand->stream_time + match_threshold >= ts
|
||||
&& cand->stream_time <= ts + match_threshold) {
|
||||
GST_DEBUG ("choosing segment %d", seg_idx);
|
||||
seg = cand;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue