Bump pyAV and close unclosed outputs (#35960)

* bump pyAV and close unclosed outputs

* skip stream from coverage for now

* fix divide by zero error
This commit is contained in:
Jason Hunter authored and Franck Nijhof committed 2020-05-24 11:27:37 +02:00
1 parent f4f031e703
commit 9e1c35cfd7
6 files changed
+12 -4

No files matched your search

+4 -1
View File
@@ -79,8 +79,11 @@ class StreamOutput:
@property
def target_duration(self) -> int:
"""Return the average duration of the segments in seconds."""
segment_length = len(self._segments)
if not segment_length:
return 0
durations = [s.duration for s in self._segments]
return round(sum(durations) // len(self._segments)) or 1
return round(sum(durations) // segment_length) or 1
def get_segment(self, sequence: int = None) -> Any:
"""Retrieve a specific segment, or the whole list."""