Skip invalid segments in stream recorder (#70896)
* Skip segment if duration is None * Copy segments deque before passing to thread
This commit is contained in:
parent
485ae70308
commit
9281f46bcd
1 changed files with 5 additions and 1 deletions
|
@ -60,6 +60,10 @@ def recorder_save_worker(file_out: str, segments: deque[Segment]) -> None:
|
|||
"r",
|
||||
format=SEGMENT_CONTAINER_FORMAT,
|
||||
)
|
||||
# Skip this segment if it doesn't have data
|
||||
if source.duration is None:
|
||||
source.close()
|
||||
continue
|
||||
source_v = source.streams.video[0]
|
||||
source_a = source.streams.audio[0] if len(source.streams.audio) > 0 else None
|
||||
|
||||
|
@ -137,7 +141,7 @@ class RecorderOutput(StreamOutput):
|
|||
thread = threading.Thread(
|
||||
name="recorder_save_worker",
|
||||
target=recorder_save_worker,
|
||||
args=(self.video_path, self._segments),
|
||||
args=(self.video_path, self._segments.copy()),
|
||||
)
|
||||
thread.start()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue