Skip to content

Commit

Permalink
#379: since we cannot teardown an existing sound pipeline and start a…
Browse files Browse the repository at this point in the history
… new one on osx, keep the current one and try to recover using the sound-sequence mechanism

git-svn-id: https://xpra.org/svn/Xpra/trunk@3871 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 18, 2013
1 parent ae6ff16 commit e6bf79f
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,8 @@ def bump_sound_sequence(self):
#server supports the "sound-sequence" feature
#tell it to use a new one:
self.min_sound_sequence += 1
self.send("sound-control", "new-sequence", self.min_sound_sequence)
#via idle add so this will wait for UI thread to catch up if needed:
self.idle_add(self.send, "sound-control", "new-sequence", self.min_sound_sequence)

def start_sound_sink(self, codec):
assert self.sound_sink is None
Expand All @@ -851,14 +852,20 @@ def sound_sink_error(*args):
self.stop_receiving_sound()
def sound_sink_overrun(*args):
log.warn("re-starting speaker because of overrun")
self.bump_sound_sequence()
def sink_clean():
log("sink_clean() sound_sink=%s, server_sound_sequence=%s", self.sound_sink, self.server_sound_sequence)
if self.sound_sink:
self.sound_sink.cleanup()
self.sound_sink = None
self.idle_add(sink_clean)
#Note: the next sound packet will take care of starting a new pipeline
if self.server_sound_sequence:
#this should be enough to recover:
self.bump_sound_sequence()
else:
#for older servers: teardown and start again
#note: this may not work on all platforms...
def sink_clean():
log("sink_clean() sound_sink=%s, server_sound_sequence=%s", self.sound_sink, self.server_sound_sequence)
sink = self.sound_sink
if sink:
self.sound_sink = None
sink.cleanup()
self.idle_add(sink_clean)
#Note: the next sound packet will take care of starting a new pipeline
try:
log("starting %s sound sink", codec)
from xpra.sound.sink import SoundSink
Expand Down

0 comments on commit e6bf79f

Please sign in to comment.