The vlc _reset_state logic should be wrapped within a lock context to make sure that two threads don't try to deallocate the context at the same time
This commit is contained in:
parent
833f810d4b
commit
0e3845ef88
1 changed files with 14 additions and 12 deletions
|
@ -51,6 +51,7 @@ class MediaVlcPlugin(MediaPlugin):
|
||||||
self._filename = None
|
self._filename = None
|
||||||
self._monitor_thread: Optional[threading.Thread] = None
|
self._monitor_thread: Optional[threading.Thread] = None
|
||||||
self._on_stop_event = threading.Event()
|
self._on_stop_event = threading.Event()
|
||||||
|
self._stop_lock = threading.RLock()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _watched_event_types(cls):
|
def _watched_event_types(cls):
|
||||||
|
@ -93,20 +94,21 @@ class MediaVlcPlugin(MediaPlugin):
|
||||||
self._reset_state()
|
self._reset_state()
|
||||||
|
|
||||||
def _reset_state(self):
|
def _reset_state(self):
|
||||||
self._latest_seek = None
|
with self._stop_lock:
|
||||||
self._title = None
|
self._latest_seek = None
|
||||||
self._filename = None
|
self._title = None
|
||||||
self._on_stop_event.clear()
|
self._filename = None
|
||||||
|
self._on_stop_event.clear()
|
||||||
|
|
||||||
if self._player:
|
if self._player:
|
||||||
self.logger.info('Releasing VLC player resource')
|
self.logger.info('Releasing VLC player resource')
|
||||||
self._player.release()
|
self._player.release()
|
||||||
self._player = None
|
self._player = None
|
||||||
|
|
||||||
if self._instance:
|
if self._instance:
|
||||||
self.logger.info('Releasing VLC instance resource')
|
self.logger.info('Releasing VLC instance resource')
|
||||||
self._instance.release()
|
self._instance.release()
|
||||||
self._instance = None
|
self._instance = None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _post_event(evt_type, **evt):
|
def _post_event(evt_type, **evt):
|
||||||
|
|
Loading…
Reference in a new issue