Fix VLC reconnect
This commit is contained in:
parent
0f7709e7a4
commit
772c4e5422
@ -129,7 +129,7 @@ MPV_SENDMESSAGE_COOLDOWN_TIME = 0.05
|
|||||||
MPV_MAX_NEWFILE_COOLDOWN_TIME = 3
|
MPV_MAX_NEWFILE_COOLDOWN_TIME = 3
|
||||||
STREAM_ADDITIONAL_IGNORE_TIME = 10
|
STREAM_ADDITIONAL_IGNORE_TIME = 10
|
||||||
MPV_LOCK_WAIT_TIME = 0.05
|
MPV_LOCK_WAIT_TIME = 0.05
|
||||||
VLC_OPEN_MAX_WAIT_TIME = 15
|
VLC_OPEN_MAX_WAIT_TIME = 20
|
||||||
VLC_MIN_PORT = 10000
|
VLC_MIN_PORT = 10000
|
||||||
VLC_MAX_PORT = 55000
|
VLC_MAX_PORT = 55000
|
||||||
|
|
||||||
|
|||||||
@ -413,13 +413,18 @@ class VlcPlayer(BasePlayer):
|
|||||||
self._ibuffer.append(data)
|
self._ibuffer.append(data)
|
||||||
|
|
||||||
def handle_close(self):
|
def handle_close(self):
|
||||||
asynchat.async_chat.handle_close(self)
|
if self.timeVLCLaunched and time.time() - self.timeVLCLaunched < constants.VLC_OPEN_MAX_WAIT_TIME:
|
||||||
if self.timeVLCLaunched and time.time() - self.timeVLCLaunched > constants.VLC_OPEN_MAX_WAIT_TIME:
|
try:
|
||||||
self.__playerController._client.ui.showDebugMessage("Failed to connect to VLC, but reconnecting as within max wait time")
|
self.__playerController._client.ui.showDebugMessage("Failed to connect to VLC, but reconnecting as within max wait time")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self.run()
|
self.run()
|
||||||
if self.vlcHasResponded:
|
elif self.vlcHasResponded:
|
||||||
|
asynchat.async_chat.handle_close(self)
|
||||||
self.__playerController.drop()
|
self.__playerController.drop()
|
||||||
else:
|
else:
|
||||||
|
self.vlcHasResponded = True
|
||||||
|
asynchat.async_chat.handle_close(self)
|
||||||
self.__playerController.drop(getMessage("vlc-failed-connection").format(constants.VLC_MIN_VERSION))
|
self.__playerController.drop(getMessage("vlc-failed-connection").format(constants.VLC_MIN_VERSION))
|
||||||
|
|
||||||
def found_terminator(self):
|
def found_terminator(self):
|
||||||
@ -440,3 +445,9 @@ class VlcPlayer(BasePlayer):
|
|||||||
pass
|
pass
|
||||||
if line == "close-vlc":
|
if line == "close-vlc":
|
||||||
self._vlcclosed.set()
|
self._vlcclosed.set()
|
||||||
|
if not self.connected and not self.timeVLCLaunched:
|
||||||
|
# For circumstances where Syncplay is not connected to VLC and is not reconnecting
|
||||||
|
try:
|
||||||
|
self.__process.terminate()
|
||||||
|
except: # When VLC is already closed
|
||||||
|
pass
|
||||||
Loading…
x
Reference in New Issue
Block a user