File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,17 +139,19 @@ def _read_loop(self) -> None:
139139 except BaseException as e :
140140 self ._reader_exc = e
141141 finally :
142- # Sentinel must reach every consumer or its blocking read() deadlocks.
143- # Drop the oldest frame whenever the queue is full; we are the sole writer,
144- # so after a successful get_nowait() the queue has room for the EOF.
142+ # Sentinel must reach every consumer or its blocking read() deadlocks. On normal
143+ # EOF the put must respect back-pressure (a full queue still holds undelivered
144+ # frames); only once an abort is in progress may pending frames be dropped to
145+ # force the sentinel through.
145146 for q in self ._queues :
146147 while True :
147148 try :
148- q .put_nowait (_EOF )
149+ q .put (_EOF , timeout = 0.1 )
149150 break
150151 except queue .Full :
151- with contextlib .suppress (queue .Empty ):
152- q .get_nowait ()
152+ if self ._stop .is_set ():
153+ with contextlib .suppress (queue .Empty ):
154+ q .get_nowait ()
153155
154156
155157class _FanOutConsumer (VideoStream ):
You can’t perform that action at this time.
0 commit comments