Return target duration of 1 when no segments (#40518)

This commit is contained in:
uvjustin 2020-09-30 23:46:35 +08:00 committed by GitHub
parent 5658abfaca
commit e85d1deddd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,7 @@ class StreamOutput:
"""Return the max duration of any given segment in seconds."""
segment_length = len(self._segments)
if not segment_length:
return 0
return 1
durations = [s.duration for s in self._segments]
return round(max(durations)) or 1