[media.vlc] Prevent deadlock on media.vlc.quit
.
`_on_stop_event` may be set by the callback, but then cleared again when `_reset_state` is called. This can result in the `_on_stop_event.wait` call in `quit` to time out. Instead, `_on_stop_event` should be cleared only when the player goes into `playing` or `paused` mode. It's only then that we know for sure that the state isn't `stopped`, and only in that case it makes sense to wait for a stop.
This commit is contained in:
parent
6e27c9b8e4
commit
2b48edfabc
1 changed files with 2 additions and 1 deletions
|
@ -126,7 +126,6 @@ class MediaVlcPlugin(MediaPlugin):
|
||||||
|
|
||||||
def _reset_state(self):
|
def _reset_state(self):
|
||||||
self._latest_seek = None
|
self._latest_seek = None
|
||||||
self._on_stop_event.clear()
|
|
||||||
|
|
||||||
if self._latest_resource:
|
if self._latest_resource:
|
||||||
self.logger.debug('Closing latest resource')
|
self.logger.debug('Closing latest resource')
|
||||||
|
@ -175,8 +174,10 @@ class MediaVlcPlugin(MediaPlugin):
|
||||||
|
|
||||||
self.logger.debug('Received VLC event: %s', event.type)
|
self.logger.debug('Received VLC event: %s', event.type)
|
||||||
if event.type == EventType.MediaPlayerPlaying: # type: ignore
|
if event.type == EventType.MediaPlayerPlaying: # type: ignore
|
||||||
|
self._on_stop_event.clear()
|
||||||
self._post_event(MediaPlayEvent, resource=self._get_current_resource())
|
self._post_event(MediaPlayEvent, resource=self._get_current_resource())
|
||||||
elif event.type == EventType.MediaPlayerPaused: # type: ignore
|
elif event.type == EventType.MediaPlayerPaused: # type: ignore
|
||||||
|
self._on_stop_event.clear()
|
||||||
self._post_event(MediaPauseEvent)
|
self._post_event(MediaPauseEvent)
|
||||||
elif event.type in (
|
elif event.type in (
|
||||||
EventType.MediaPlayerStopped, # type: ignore
|
EventType.MediaPlayerStopped, # type: ignore
|
||||||
|
|
Loading…
Reference in a new issue