fix case when playlist is slightly to short, fix #100

This commit is contained in:
jonathan 2021-06-21 14:58:55 +02:00
parent ded3fd5f1c
commit 14f6efeb01

View File

@ -322,6 +322,7 @@ class GetSourceFromPlaylist:
check if playlist length is 24 hours and matches current length, check if playlist length is 24 hours and matches current length,
to get the date for a new playlist to get the date for a new playlist
""" """
if self.node is not None: if self.node is not None:
out = self.node['out'] out = self.node['out']
delta = 0 delta = 0
@ -335,7 +336,8 @@ class GetSourceFromPlaylist:
delta += seek + 1 delta += seek + 1
next_start = begin - playlist.start + out + delta next_start = begin - playlist.start + out + delta
elif begin == playlist.start:
next_start = playlist.length + 1
else: else:
delta, _ = get_delta(begin) delta, _ = get_delta(begin)
next_start = begin - playlist.start + sync_op.threshold + delta next_start = begin - playlist.start + sync_op.threshold + delta
@ -376,7 +378,8 @@ class GetSourceFromPlaylist:
# balance small difference to start time # balance small difference to start time
if playlist.start is not None and isclose(playlist.start, if playlist.start is not None and isclose(playlist.start,
current_time, abs_tol=2): current_time, abs_tol=2):
begin = playlist.start self.node = None
self.check_for_next_playlist(playlist.start)
else: else:
self.init_time() self.init_time()
begin = self.last_time begin = self.last_time