Skip to content

Commit

Permalink
#1617: if XPRA_NEW_STREAM_SOUND is enabled (it is by default) then we…
Browse files Browse the repository at this point in the history
… play the "bell.wav" sample whenever a client sound stream starts

git-svn-id: https://xpra.org/svn/Xpra/trunk@16676 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 10, 2017
1 parent b133815 commit c6e0590
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions rpmbuild/xpra.spec
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/xpra/README
%{_datadir}/xpra/COPYING
%{_datadir}/xpra/icons
%{_datadir}/xpra/*.wav
%ifarch x86_64
%{_datadir}/xpra/cuda
%endif
Expand Down
2 changes: 2 additions & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,7 @@ def add_service_exe(script, icon, base_name):
raise

add_data_files('', glob.glob("win32\\bundle-extra\\*"))
add_data_files('', "bell.wav")

#END OF win32
#*******************************************************************************
Expand All @@ -1429,6 +1430,7 @@ def add_service_exe(script, icon, base_name):
add_data_files("share/mime/packages", ["xdg/application-x-xpraconfig.xml"])
add_data_files("share/icons", ["xdg/xpra.png", "xdg/xpra-mdns.png"])
add_data_files("share/appdata", ["xdg/xpra.appdata.xml"])
add_data_files('share/xpra/', ["bell.wav"])

#here, we override build and install so we can
#generate our /etc/xpra/xpra.conf
Expand Down
21 changes: 20 additions & 1 deletion src/xpra/server/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from xpra.net.compression import compressed_wrapper, Compressed, Compressible
from xpra.net.file_transfer import FileTransferHandler
from xpra.make_thread import start_thread
from xpra.os_util import platform_name, Queue, get_machine_id, get_user_uuid, monotonic_time, BytesIOClass, WIN32
from xpra.os_util import platform_name, Queue, get_machine_id, get_user_uuid, monotonic_time, BytesIOClass, WIN32, POSIX
from xpra.server.background_worker import add_work_item
from xpra.util import csv, std, typedict, updict, flatten_dict, notypedict, get_screen_info, envint, envbool, AtomicInteger, \
CLIENT_PING_TIMEOUT, WORKSPACE_UNSET, DEFAULT_METADATA_SUPPORTED
Expand All @@ -61,6 +61,7 @@ def no_legacy_names(v):
ADD_LOCAL_PRINTERS = envbool("XPRA_ADD_LOCAL_PRINTERS", False)
GRACE_PERCENT = envint("XPRA_GRACE_PERCENT", 90)
AV_SYNC_DELTA = envint("XPRA_AV_SYNC_DELTA", 0)
NEW_STREAM_SOUND = envbool("XPRA_NEW_STREAM_SOUND", True)

PRINTER_LOCATION_STRING = os.environ.get("XPRA_PRINTER_LOCATION_STRING", "via xpra")
PROPERTIES_DEBUG = [x.strip() for x in os.environ.get("XPRA_WINDOW_PROPERTIES_DEBUG", "").split(",")]
Expand Down Expand Up @@ -1083,6 +1084,24 @@ def send_eos(self, codec, sequence=0):


def new_stream(self, sound_source, codec):
if NEW_STREAM_SOUND:
try:
from xpra.platform.paths import get_resources_dir
sample = os.path.join(get_resources_dir(), "bell.wav")
soundlog("new_stream(%s, %s) sample=%s, exists=%s", sound_source, codec, sample, os.path.exists(sample))
if os.path.exists(sample):
if POSIX:
sink = "alsasink"
else:
sink = "autoaudiosink"
cmd = ["gst-launch-1.0", "-q", "filesrc", "location=%s" % sample, "!", "decodebin", "!", "audioconvert", "!", sink]
import subprocess
proc = subprocess.Popen(cmd, close_fds=True)
soundlog("Popen(%s)=%s", cmd, proc)
from xpra.child_reaper import getChildReaper
getChildReaper().add_process(proc, "new-stream-sound", cmd, ignore=True, forget=True)
except:
pass
soundlog("new_stream(%s, %s)", sound_source, codec)
if self.sound_source!=sound_source:
soundlog("dropping new-stream signal (current source=%s, signal source=%s)", self.sound_source, sound_source)
Expand Down

0 comments on commit c6e0590

Please sign in to comment.