Skip to content

Commit 4fe154e

Browse files
BordaCopilot
andauthored
Update supervision/utils/video.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 63eb824 commit 4fe154e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

supervision/utils/video.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,14 @@ def writer_thread(video_sink: VideoSink) -> None:
329329
read_item = frame_read_queue.get(timeout=1)
330330
if read_item is None:
331331
break
332-
# If we timeout waiting for a frame, assume the reader thread failed
332+
# If we timeout waiting for a frame, only assume failure if the reader
333+
# thread is no longer alive. Otherwise, keep waiting as the reader
334+
# may simply be slow (for example, due to a slow source).
333335
except Empty:
334-
break
336+
if not reader_worker.is_alive():
337+
break
338+
# Reader is still alive; continue waiting for frames.
339+
continue
335340
reader_worker.join()
336341
writer_worker.join()
337342
progress_bar.close()

0 commit comments

Comments
 (0)