Skip to content

Commit

Permalink
perf: speed up vlc player termination
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhd1701 committed Jun 9, 2022
1 parent fd3668e commit 6454fa2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gridplayer/vlc_player/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ def init_instance(self):

self.vlc_instance = vlc.Instance(options)

self.vlc_instance.set_user_agent(VLC_USER_AGENT_NAME, VLC_USER_AGENT)

if self.vlc_instance is None:
raise RuntimeError("VLC failed to initialize")

self.vlc_instance.set_user_agent(VLC_USER_AGENT_NAME, VLC_USER_AGENT)

self.init_logger()

# process
Expand Down
6 changes: 4 additions & 2 deletions gridplayer/vlc_player/player_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ def cleanup(self):
self._event_waiter.abort()

if self._media_player is not None:
self.stop()
self._log.debug("Releasing player")

self._media_player.release()
media_player = self._media_player
self._media_player = None

media_player.release()

def error(self, message):
self._log.error(message)
self.notify_error()
Expand Down

0 comments on commit 6454fa2

Please sign in to comment.