fix: fix bug

This commit is contained in:
acgnhik 2022-07-20 15:41:35 +08:00
parent 17ea3ffc04
commit a4d61c1f29

View File

@ -77,19 +77,19 @@ def fix() -> Callable[[FLVStream], FLVStream]:
def update_delta(tag: FlvTag) -> None: def update_delta(tag: FlvTag) -> None:
nonlocal delta nonlocal delta
assert last_tag is not None
assert last_video_tag is not None
assert last_audio_tag is not None
if is_video_tag(tag): if is_video_tag(tag):
assert last_video_tag is not None
delta = ( delta = (
last_video_tag.timestamp - tag.timestamp + video_frame_interval last_video_tag.timestamp - tag.timestamp + video_frame_interval
) )
elif is_audio_tag(tag): elif is_audio_tag(tag):
assert last_audio_tag is not None
delta = ( delta = (
last_audio_tag.timestamp - tag.timestamp + sound_sample_interval last_audio_tag.timestamp - tag.timestamp + sound_sample_interval
) )
assert last_tag is not None
if tag.timestamp + delta <= last_tag.timestamp: if tag.timestamp + delta <= last_tag.timestamp:
if is_video_tag(tag): if is_video_tag(tag):
delta = ( delta = (