mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
hlsdemux2: Minor refactoring of starting segment check
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6610>
This commit is contained in:
parent
5bc9883d68
commit
c924e4cc1e
1 changed files with 28 additions and 28 deletions
|
@ -2110,6 +2110,10 @@ gst_hls_media_playlist_get_starting_segment (GstHLSMediaPlaylist * self,
|
|||
res = g_ptr_array_index (self->segments, 0);
|
||||
} else {
|
||||
GstClockTime hold_back = GST_CLOCK_TIME_NONE;
|
||||
GstM3U8MediaSegment *last_seg;
|
||||
g_assert (self->segments->len);
|
||||
last_seg = g_ptr_array_index (self->segments, self->segments->len - 1);
|
||||
|
||||
/* Live playlist. If low-latency, use the PART-HOLD-BACK specified distance
|
||||
* from the end, otherwise HOLD-BACK distance */
|
||||
if (GST_CLOCK_TIME_IS_VALID (self->part_hold_back))
|
||||
|
@ -2135,11 +2139,8 @@ gst_hls_media_playlist_get_starting_segment (GstHLSMediaPlaylist * self,
|
|||
hold_back = GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE * self->targetduration;
|
||||
}
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (hold_back)) {
|
||||
GstM3U8MediaSegment *last_seg =
|
||||
g_ptr_array_index (self->segments, self->segments->len - 1);
|
||||
|
||||
if (GST_CLOCK_STIME_IS_VALID (last_seg->stream_time)) {
|
||||
if (GST_CLOCK_TIME_IS_VALID (hold_back)
|
||||
&& GST_CLOCK_STIME_IS_VALID (last_seg->stream_time)) {
|
||||
GstSeekFlags flags =
|
||||
GST_SEEK_FLAG_SNAP_BEFORE | GST_SEEK_FLAG_KEY_UNIT |
|
||||
GST_HLS_M3U8_SEEK_FLAG_ALLOW_PARTIAL;
|
||||
|
@ -2171,7 +2172,6 @@ gst_hls_media_playlist_get_starting_segment (GstHLSMediaPlaylist * self,
|
|||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Worst case fallback, start 3 fragments from the end */
|
||||
if (res == NULL) {
|
||||
|
|
Loading…
Reference in a new issue