diff --git a/src/xpra/net/subprocess_wrapper.py b/src/xpra/net/subprocess_wrapper.py index f0608ee250..354033f307 100644 --- a/src/xpra/net/subprocess_wrapper.py +++ b/src/xpra/net/subprocess_wrapper.py @@ -62,6 +62,7 @@ def __init__(self, input_filename="-", output_filename="-", wrapped_object=None, self.input_filename = input_filename self.output_filename = output_filename self.method_whitelist = None + self.large_packets = [] #the gobject instance which is wrapped: self.wrapped_object = wrapped_object self.send_queue = Queue() @@ -136,6 +137,7 @@ def make_protocol(self): except Exception as e: log.warn("failed to enable rencode: %s", e) protocol.enable_compressor("none") + protocol.large_packets = self.large_packets return protocol @@ -228,6 +230,7 @@ def __init__(self, description="wrapper"): self.description = description self.send_queue = Queue() self.signal_callbacks = {} + self.large_packets = [] #hook a default packet handlers: self.connect(Protocol.CONNECTION_LOST, self.connection_lost) @@ -255,6 +258,7 @@ def make_protocol(self): protocol.enable_encoder("rencode") #we assume this is local, so no compression: protocol.enable_compressor("none") + protocol.large_packets = self.large_packets return protocol diff --git a/src/xpra/sound/wrapper.py b/src/xpra/sound/wrapper.py index fff3ecd13e..4756cae605 100644 --- a/src/xpra/sound/wrapper.py +++ b/src/xpra/sound/wrapper.py @@ -44,7 +44,7 @@ class sound_subprocess(subprocess_callee): """ def __init__(self, wrapped_object, method_whitelist, exports_list): #add bits common to both record and play: - methods = method_whitelist+["set_volume", "stop"] + methods = method_whitelist+["set_volume", "stop", "cleanup"] exports = ["state-changed", "bitrate-changed", "error"] + exports_list subprocess_callee.__init__(self, wrapped_object=wrapped_object, method_whitelist=methods) for x in exports: @@ -77,12 +77,7 @@ def __init__(self, *pipeline_args): from xpra.sound.src import SoundSource sound_pipeline = SoundSource(*pipeline_args) sound_subprocess.__init__(self, sound_pipeline, [], ["new-stream", "new-buffer"]) - - def make_protocol(self): - #overriden so we can tell that "new-buffer" is a large packet: - p = subprocess_callee.make_protocol(self) - p.large_packets = ["new-buffer"] - return p + self.large_packets = ["new-buffer"] class sound_play(sound_subprocess): """ wraps SoundSink as a subprocess """ @@ -187,14 +182,10 @@ class source_subprocess_wrapper(sound_subprocess_wrapper): def __init__(self, plugin, options, codecs, volume, element_options): sound_subprocess_wrapper.__init__(self, "sound-source") + self.large_packets = ["new-buffer"] self.command = [get_sound_executable(), "_sound_record", "-", "-", plugin or "", "", ",".join(codecs), "", str(volume)] self._add_debug_args() - def make_protocol(self): - protocol = subprocess_caller.make_protocol(self) - protocol.large_packets = ["new-buffer"] - return protocol - def __repr__(self): return "source_subprocess_wrapper(%s)" % self.process @@ -203,15 +194,11 @@ class sink_subprocess_wrapper(sound_subprocess_wrapper): def __init__(self, plugin, options, codec, volume, element_options): sound_subprocess_wrapper.__init__(self, "sound-sink") + self.large_packets = ["add_data"] self.codec = codec self.command = [get_sound_executable(), "_sound_play", "-", "-", plugin or "", "", codec, "", str(volume)] self._add_debug_args() - def make_protocol(self): - protocol = subprocess_caller.make_protocol(self) - protocol.large_packets = ["add_data"] - return protocol - def add_data(self, data, metadata): if DEBUG_SOUND: log("add_data(%s bytes, %s) forwarding to %s", len(data), metadata, self.protocol)