Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
soundlog("stop_receiving_sound() sound sink=%s", self.sound_sink)
ss = self.sound_sink
self.speaker_enabled = False
if ss is None:
return
self.sound_sink = None
self.send("sound-control", "stop")
def stop_receiving_sound_thread():
soundlog("UIXpraClient.stop_receiving_sound_thread()")
if ss is None:
log("stop_receiving_sound: sound not started!")
return
ss.cleanup()
self.emit("speaker-changed")
soundlog("UIXpraClient.stop_receiving_sound_thread() done")
thread.start_new_thread(stop_receiving_sound_thread, ())
def stop_sending_sound(self):
""" stop the sound source and emit client signal """
soundlog("stop_sending_sound() sound source=%s", self.sound_source)
ss = self.sound_source
self.microphone_enabled = False
self.sound_source = None
def stop_sending_sound_thread():
soundlog("UIXpraClient.stop_sending_sound_thread()")
if ss is None:
log.warn("stop_sending_sound: sound not started!")
return
ss.cleanup()
self.emit("microphone-changed")
soundlog("UIXpraClient.stop_sending_sound_thread() done")
thread.start_new_thread(stop_sending_sound_thread, ())
ss = self.sound_sink
self.speaker_enabled = False
if tell_server:
self.send("sound-control", "stop")
if ss is None:
return
self.sound_sink = None
def stop_receiving_sound_thread():
soundlog("UIXpraClient.stop_receiving_sound_thread()")
if ss is None:
log("stop_receiving_sound: sound not started!")
return
ss.cleanup()
self.emit("speaker-changed")
soundlog("UIXpraClient.stop_receiving_sound_thread() done")
thread.start_new_thread(stop_receiving_sound_thread, ())
def check_for_end(*args):
qtime = int(ss.queue.get_property("current-level-time")/MS_TO_NS)
if qtime<=0:
log.info("underrun (end of stream)")
thread.start_new_thread(ss.stop, ())
gobject.timeout_add(500, gobject_mainloop.quit)
return False
return True
gobject.timeout_add(1000, check_for_end)
def get_all_info(self, callback, proto, sources, wids):
ui_info = self.get_ui_info(proto, wids)
def in_thread(*args):
try:
info = self.get_info(proto)
ui_info.update(info)
except Exception, e:
log.error("error during info collection: %s", e, exc_info=True)
callback(ui_info)
thread.start_new_thread(in_thread, ())
def stop_sending_sound(self):
ss = self.sound_source
soundlog("stop_sending_sound() sound_source=%s", ss)
if ss:
self.sound_source = None
if self.server_driven:
#tell the client this is the end:
self.send("sound-data", ss.codec, "", {"end-of-stream" : True})
def stop_sending_sound_thread(*args):
soundlog("stop_sending_sound_thread(%s)", args)
ss.cleanup()
soundlog("stop_sending_sound_thread(%s) done", args)
thread.start_new_thread(stop_sending_sound_thread, ())
def cleanup(self, *args):
if self.notifications_forwarder:
thread.start_new_thread(self.notifications_forwarder.release, ())
self.notifications_forwarder = None
ServerCore.cleanup(self)
def stop_sending_sound(self):
ss = self.sound_source
soundlog("stop_sending_sound() sound_source=%s", ss)
if ss:
self.sound_source = None
if self.server_driven:
#tell the client this is the end:
self.send("sound-data", ss.codec, "", {"end-of-stream" : True})
def stop_sending_sound_thread(*args):
soundlog("stop_sending_sound_thread(%s)", args)
ss.cleanup()
soundlog("stop_sending_sound_thread(%s) done", args)
thread.start_new_thread(stop_sending_sound_thread, ())
def check_for_end(*args):
qtime = int(ss.queue.get_property("current-level-time")/MS_TO_NS)
if qtime<=0:
log.info("underrun (end of stream)")
thread.start_new_thread(ss.stop, ())
gobject.timeout_add(500, gobject_mainloop.quit)
return False
return True
gobject.timeout_add(1000, check_for_end)