Skip to content

Commit

Permalink
Tweak sleep interval for other FPS #597
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlt8 committed Nov 13, 2022
1 parent 2a9838f commit 8c82e07
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/wyzecam/iotc.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,15 +478,14 @@ def recv_bridge_frame(
continue
self.state = WyzeIOTCSessionState.CONNECTING_FAILED
raise Exception(f"Stream did not receive a frame for over {timeout}s")

if (sleep_interval := (1 / (fps + 5)) - delta) > 0:
if (sleep_interval := ((1 / fps) - 0.01) - delta) > 0:
time.sleep(sleep_interval)

errno, frame_data, frame_info, frame_index = tutk.av_recv_frame_data(
self.tutk_platform_lib, self.av_chan_id
)
if errno < 0:
time.sleep(1 / (fps + 10))
time.sleep((1 / (fps)) - 0.02)
if errno == tutk.AV_ER_DATA_NOREADY:
continue
if errno in (
Expand Down Expand Up @@ -519,7 +518,7 @@ def recv_bridge_frame(
and not keep_bad_frames
):
warnings.warn("Waiting for keyframe")
time.sleep(1 / (fps + 10))
time.sleep((1 / (fps)) - 0.02)
continue
elif time.time() - frame_info.timestamp > timeout:
warnings.warn("frame too old")
Expand Down

0 comments on commit 8c82e07

Please sign in to comment.