Skip to content

Commit

Permalink
When the osx UI thread is blocked, we will accumulate sound buffers t…
Browse files Browse the repository at this point in the history
…hat were sent before we told the server to "suspend", and so when we resume, all these pending buffers cause an overrun. Instead, we now "bump_sound_sequence()" to just drop those old sound buffers.

git-svn-id: https://xpra.org/svn/Xpra/trunk@3869 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jul 16, 2013
1 parent 28c6c5b commit b98b79c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/xpra/client/gtk2/client.py
Expand Up @@ -233,6 +233,7 @@ def poll_UI_loop(*args):
if not self.UI_blocked_sent:
log.info("UI thread is blocked, pausing server")
self.send("suspend", True, self._id_to_window.keys())
self.bump_sound_sequence()
self.UI_blocked_sent = True
time.sleep(1.0)
thread.start_new_thread(poll_UI_loop, ())
Expand Down
13 changes: 8 additions & 5 deletions src/xpra/client/ui_client_base.py
Expand Up @@ -833,6 +833,13 @@ def stop_receiving_sound(self):
self.emit("speaker-changed")
log("XpraClient.stop_receiving_sound() done")

def bump_sound_sequence(self):
if self.server_sound_sequence:
#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)

def start_sound_sink(self, codec):
assert self.sound_sink is None
def sound_sink_state_changed(*args):
Expand All @@ -844,11 +851,7 @@ def sound_sink_error(*args):
self.stop_receiving_sound()
def sound_sink_overrun(*args):
log.warn("re-starting speaker because of overrun")
if self.server_sound_sequence:
#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)
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:
Expand Down

0 comments on commit b98b79c

Please sign in to comment.