Fix QSocketNotifier issue with qt5reactor
Sending the call to transport.write wrapped in a self.reactor.callFromThread instead of directly does the trick. Include also fixes to allow correct quit of VLC and Syncplay when either one is closed. Known issues: there is a noticeable lag (~ 1 second) between the start of Syncplay MainWindow and the start of VLC.
This commit is contained in:
parent
bb494a291b
commit
952cc60898
@ -39,14 +39,6 @@ class VLCProtocol(LineReceiver):
|
|||||||
self.factory._playerController._client.ui.showDebugMessage("player >> {}".format(line))
|
self.factory._playerController._client.ui.showDebugMessage("player >> {}".format(line))
|
||||||
# except:
|
# except:
|
||||||
# pass
|
# pass
|
||||||
if line == "close-vlc":
|
|
||||||
self.factory._playerController._vlcclosed.set()
|
|
||||||
if not self.factory.connected and not self.factory.timeVLCLaunched:
|
|
||||||
# For circumstances where Syncplay is not connected to VLC and is not reconnecting
|
|
||||||
#try:
|
|
||||||
self.factory._process.terminate()
|
|
||||||
#except: # When VLC is already closed
|
|
||||||
# pass
|
|
||||||
|
|
||||||
def connectionMade(self):
|
def connectionMade(self):
|
||||||
self.factory.connected = True
|
self.factory.connected = True
|
||||||
@ -86,6 +78,15 @@ class VLCClientFactory(ClientFactory):
|
|||||||
self.vlcHasResponded = True
|
self.vlcHasResponded = True
|
||||||
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 closeVLC(self):
|
||||||
|
self._playerController._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
|
||||||
|
|
||||||
|
|
||||||
class VlcPlayer(BasePlayer):
|
class VlcPlayer(BasePlayer):
|
||||||
speedSupported = True
|
speedSupported = True
|
||||||
@ -379,7 +380,7 @@ class VlcPlayer(BasePlayer):
|
|||||||
def drop(self, dropErrorMessage=None):
|
def drop(self, dropErrorMessage=None):
|
||||||
if self._listener:
|
if self._listener:
|
||||||
self._vlcclosed.clear()
|
self._vlcclosed.clear()
|
||||||
self._listener.sendLine('close-vlc')
|
self._listener._factory.closeVLC()
|
||||||
self._vlcclosed.wait()
|
self._vlcclosed.wait()
|
||||||
self._durationAsk.set()
|
self._durationAsk.set()
|
||||||
self._filenameAsk.set()
|
self._filenameAsk.set()
|
||||||
@ -533,4 +534,4 @@ class VlcPlayer(BasePlayer):
|
|||||||
out.close()
|
out.close()
|
||||||
|
|
||||||
def sendLine(self, line):
|
def sendLine(self, line):
|
||||||
self._factory.protocol.sendLine(line)
|
self.reactor.callFromThread(self._factory.protocol.sendLine, line)
|
||||||
Loading…
x
Reference in New Issue
Block a user