Skip to content

Commit

Permalink
#3709 switch to 'removesilence'
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Dec 19, 2022
1 parent 3e956ee commit 2b304a1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 2 additions & 0 deletions packaging/debian/xpra/control
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ Recommends: gstreamer1.0-tools
,gstreamer1.0-alsa
,gstreamer1.0-plugins-good
# ^^ wavpack, wav, flac, speex ^^
,gstreamer1.0-plugins-bad
# ^^ removesilence
,gstreamer1.0-plugins-ugly
# ^^ mp3 ^^
Description: the components required for xpra audio forwarding,
Expand Down
1 change: 1 addition & 0 deletions packaging/rpm/xpra.spec
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ Requires: gstreamer1
Requires: gstreamer1-plugins-base
Requires: gstreamer1-plugins-good
Recommends: gstreamer1-plugin-timestamp
Recommends: gstreamer1-plugins-bad
Recommends: gstreamer1-plugins-ugly
Recommends: gstreamer1-plugins-ugly-free
Recommends: pulseaudio
Expand Down
6 changes: 3 additions & 3 deletions xpra/sound/gstreamer_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ def force_enabled(codec_name):
#if this is lightweight enough, maybe we should include it unconditionally?
#SOURCE_NEEDS_AUDIOCONVERT = ("directsoundsrc", "osxaudiosrc", "autoaudiosrc", "wasapisrc")

CUTTER_NEEDS_RESAMPLE = ("opusenc", )
#CUTTER_NEEDS_RESAMPLE = ("opusenc", )
#those don't work anyway:
CUTTER_NEEDS_CONVERT = ("vorbisenc", "wavpackenc", "avenc_aac")
ENCODER_CANNOT_USE_CUTTER = ("vorbisenc", "wavpackenc", "avenc_aac", "wavenc")
#CUTTER_NEEDS_CONVERT = ("vorbisenc", "wavpackenc", "avenc_aac")
#ENCODER_CANNOT_USE_CUTTER = ("vorbisenc", "wavpackenc", "avenc_aac", "wavenc")


#options we use to tune for low latency:
Expand Down
18 changes: 8 additions & 10 deletions xpra/sound/src.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
get_source_plugins, get_encoder_elements,
get_encoder_default_options,
get_encoders, get_queue_time,
MP3, CODEC_ORDER, MUXER_DEFAULT_OPTIONS, ENCODER_NEEDS_AUDIOCONVERT,
SOURCE_NEEDS_AUDIOCONVERT, ENCODER_CANNOT_USE_CUTTER, CUTTER_NEEDS_CONVERT,
CUTTER_NEEDS_RESAMPLE, MS_TO_NS, GST_QUEUE_LEAK_DOWNSTREAM,
MP3, CODEC_ORDER, MUXER_DEFAULT_OPTIONS,
MS_TO_NS, GST_QUEUE_LEAK_DOWNSTREAM,
GST_FLOW_OK,
)
from xpra.net.compression import compressed_wrapper
Expand Down Expand Up @@ -116,13 +115,12 @@ def __init__(self, src_type=None, src_options=None, codecs=(), codec_options=Non
pipeline_els += [" ".join(queue_el)]
#if encoder in ENCODER_NEEDS_AUDIOCONVERT or src_type in SOURCE_NEEDS_AUDIOCONVERT:
pipeline_els += ["audioconvert"]
if CUTTER_THRESHOLD>0 and encoder not in ENCODER_CANNOT_USE_CUTTER and not fmt:
pipeline_els.append("cutter threshold=%.4f run-length=%i pre-length=%i leaky=false name=cutter" % (
CUTTER_THRESHOLD, CUTTER_RUN_LENGTH*MS_TO_NS, CUTTER_PRE_LENGTH*MS_TO_NS))
if encoder in CUTTER_NEEDS_CONVERT:
pipeline_els.append("audioconvert")
if encoder in CUTTER_NEEDS_RESAMPLE:
pipeline_els.append("audioresample")
if has_plugins("removesilence"):
pipeline_els += [
"removesilence",
"audioconvert",
"audioresample"
]
pipeline_els.append(f"volume name=volume volume={volume}")
if encoder:
encoder_str = plugin_str(encoder, codec_options or get_encoder_default_options(encoder))
Expand Down

0 comments on commit 2b304a1

Please sign in to comment.