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,23 +378,24 @@ 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
self.node = { self.node = {
'begin': begin, 'begin': begin,
'number': 0, 'number': 0,
'in': 0, 'in': 0,
'seek': 0, 'seek': 0,
'out': duration, 'out': duration,
'duration': duration + 1, 'duration': duration + 1,
'source': None 'source': None
} }
self.generate_cmd() self.generate_cmd()
self.check_for_next_playlist(begin) self.check_for_next_playlist(begin)
def eof_handling(self, begin): def eof_handling(self, begin):
""" """