Skip to content

Commit

Permalink
fix: increase init timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhd1701 committed Jun 27, 2022
1 parent 1bec65f commit 7492565
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions gridplayer/vlc_player/player_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

DEFAULT_FPS = 25
INIT_TIMEOUT = 30
SNAPSHOT_TIMEOUT = 15

MEDIA_EXTRACT_RETRY_TIME = 0.1
MEDIA_EXTRACT_TIMEOUT = int(INIT_TIMEOUT / MEDIA_EXTRACT_RETRY_TIME)
Expand Down Expand Up @@ -388,7 +389,7 @@ def snapshot(self):
self._log.debug(f"Taking snapshot to {file_path}")

try:
with self._event_waiter.waiting_for("snapshot_taken"):
with self._event_waiter.waiting_for("snapshot_taken", SNAPSHOT_TIMEOUT):
res = self._media_player.video_take_snapshot(0, str(file_path), 0, 0)
except TimeoutError:
file_path.parent.rmdir()
Expand Down Expand Up @@ -499,7 +500,7 @@ def _adjust_view_initial(self):
# otherwise adjust_view won't work
# if video is paused it happens on seek
if not self.media_input.video.is_paused:
self._event_waiter.wait_for("vout")
self._event_waiter.wait_for("vout", INIT_TIMEOUT)

self.adjust_view(
size=self.media_input.size,
Expand All @@ -514,7 +515,7 @@ def _set_pause_initial(self, is_paused):

if self.media_input.is_live and is_paused:
self.snapshot()
with self._event_waiter.waiting_for("stopped"):
with self._event_waiter.waiting_for("stopped", INIT_TIMEOUT):
self.stop()

self._is_paused = is_paused
Expand All @@ -524,11 +525,11 @@ def _set_time_initial(self, seek_ms):
return

if self._is_paused or seek_ms > 0:
with self._event_waiter.waiting_for("buffering"):
with self._event_waiter.waiting_for("buffering", INIT_TIMEOUT):
self._media_player.set_time(seek_ms)

if not self.media_track.is_audio_only:
self._event_waiter.wait_for("vout")
self._event_waiter.wait_for("vout", INIT_TIMEOUT)

def _get_media_track(self):
media_tracks = self._media.tracks_get()
Expand Down

0 comments on commit 7492565

Please sign in to comment.