@@ -141,24 +141,35 @@ async def recv(self):
141141 if self ._consecutive_timeouts >= self ._max_consecutive_timeouts :
142142 self ._consecutive_on_time = 0
143143
144- workflow_too_slow_message = ["Workflow is too heavy to process all frames on time..." ]
144+ workflow_too_slow_message = [
145+ "Workflow is too heavy to process all frames on time..."
146+ ]
145147 if np_frame is None :
146148 if not self ._last_frame :
147149 np_frame = overlay_text_on_np_frame (
148- frame .to_ndarray (format = "bgr24" ), ["Inference pipeline is starting..." ]
150+ frame .to_ndarray (format = "bgr24" ),
151+ ["Inference pipeline is starting..." ],
149152 )
150153 new_frame = VideoFrame .from_ndarray (np_frame , format = "bgr24" )
151- elif self ._max_consecutive_timeouts and self ._consecutive_timeouts >= self ._max_consecutive_timeouts :
154+ elif (
155+ self ._max_consecutive_timeouts
156+ and self ._consecutive_timeouts >= self ._max_consecutive_timeouts
157+ ):
152158 np_frame = overlay_text_on_np_frame (
153- self ._last_frame .to_ndarray (format = "bgr24" ), workflow_too_slow_message
159+ self ._last_frame .to_ndarray (format = "bgr24" ),
160+ workflow_too_slow_message ,
154161 )
155162 new_frame = VideoFrame .from_ndarray (np_frame , format = "bgr24" )
156163 else :
157164 new_frame = self ._last_frame
158165 else :
159- if self ._max_consecutive_timeouts and self ._consecutive_timeouts >= self ._max_consecutive_timeouts :
166+ if (
167+ self ._max_consecutive_timeouts
168+ and self ._consecutive_timeouts >= self ._max_consecutive_timeouts
169+ ):
160170 np_frame = overlay_text_on_np_frame (
161- self ._last_frame .to_ndarray (format = "bgr24" ), workflow_too_slow_message
171+ self ._last_frame .to_ndarray (format = "bgr24" ),
172+ workflow_too_slow_message ,
162173 )
163174 new_frame = VideoFrame .from_ndarray (np_frame , format = "bgr24" )
164175 else :
0 commit comments