Skip to content

Commit

Permalink
#1276: remove gdp codecs if the gstreamer version doesn't match
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@13450 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 24, 2016
1 parent 61a420c commit 0caaf2c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def __init__(self):
self.sound_out_bytecount = 0
self.server_pulseaudio_id = None
self.server_pulseaudio_server = None
self.server_gstreamer_version = None
self.server_sound_decoders = []
self.server_sound_encoders = []
self.server_sound_receive = False
Expand Down Expand Up @@ -1890,6 +1891,7 @@ def process_ui_capabilities(self):
from xpra.sound.common import legacy_to_new
self.server_sound_decoders = legacy_to_new(c.strlistget("sound.decoders", []))
self.server_sound_encoders = legacy_to_new(c.strlistget("sound.encoders", []))
self.server_gstreamer_version = c.strlistget("sound.gst.version")
except:
soundlog("cannot parse server sound codecs", exc_info=True)
self.server_codec_full_names = c.boolget("codec-full-names")
Expand Down Expand Up @@ -2251,6 +2253,19 @@ def send_webcam_frame(self):
return False


def get_matching_codecs(self, local_codecs, server_codecs):
matching_codecs = [x for x in local_codecs if x in server_codecs]
#gdp has compatibility issues from one version to another..
gstreamer_version = self.sound_properties.get("gst.version")
soundlog("local gstreamer version=%s, server version=%s", gstreamer_version, self.server_gstreamer_version)
try:
assert gstreamer_version[:2]==self.server_gstreamer_version[:2]
except Exception as e:
soundlog("incompatible gstreamer versions: %s", e)
matching_codecs = [x for x in matching_codecs if x.lower().find("gdp")<0]
soundlog("get_matching_codecs(%s, %s)=%s", local_codecs, server_codecs, matching_codecs)
return matching_codecs

def start_sending_sound(self, device=None):
""" (re)start a sound source and emit client signal """
soundlog("start_sending_sound(%s)", device)
Expand Down Expand Up @@ -2285,7 +2300,7 @@ def start_sound_source(self, device=None):
def sound_source_state_changed(*args):
self.emit("microphone-changed")
#find the matching codecs:
matching_codecs = [x for x in self.microphone_codecs if x in self.server_sound_decoders]
matching_codecs = self.get_matching_codecs(self.microphone_codecs, self.server_sound_decoders)
soundlog("start_sound_source(%s) matching codecs: %s", device, csv(matching_codecs))
if len(matching_codecs)==0:
log.error("Error: no matching codecs between client and server")
Expand Down Expand Up @@ -2353,7 +2368,7 @@ def start_receiving_sound(self):
log.error("Error receiving sound: support not enabled on the server")
return
#choose a codec:
matching_codecs = [x for x in self.speaker_codecs if x in self.server_sound_encoders]
matching_codecs = self.get_matching_codecs(self.speaker_codecs, self.server_sound_encoders)
soundlog("start_receiving_sound() matching codecs: %s", csv(matching_codecs))
if len(matching_codecs)==0:
log.error("Error: no matching codecs between client and server")
Expand Down

0 comments on commit 0caaf2c

Please sign in to comment.