[Thinlinc-technical] tlclient on Linux: pulseaudio sink inputs not allowed to move to different sink?

Jens Maus j.maus at hzdr.de
Thu Jan 16 15:10:54 CET 2014


Hello ThinLincer,

at the moment we are playing around in optimizing our thin clients which are based on an adapted “thinstation” Linux version optimized for the intel NUC hardware (see https://github.com/hzdr/thinstation). We are currently trying to implement auto-switching of audio output devices depending on which audio output source is currently plugged in (headphones, external usb speaker, etc.). While switching of audio output sources seem to work fine when using e.g. “xfreerdp” and its integrated pulseaudio support, we are not able to move the pulse audio audio sink input streams generated by ThinLinc to another audio output using the following script:

— cut here —
#!/bin/bash
#
# a shell script that sets a new pulseaudio sink as the default one. In addition,
# it will move all existing streams to the new default sink using "move-sink-input"
#

if [ -z "$1" ]; then
    echo "Usage: $0 <sinkId/sinkName>" >&2
    echo "Valid sinks:" >&2
    pactl list short sinks >&2
    exit 1
fi

newSink="$1"
pactl list short sink-inputs | while read stream; do
    streamId=$(echo $stream | cut -d ' ' -f1)
    echo "moving stream ${streamId} to ${newSink}"
    pactl move-sink-input "${streamId}" "${newSink}"
done

pactl set-default-sink "${newSink}”
— cut here — 

The main point of that script is, that it moves sink input streams via “pactl move-sink-input” to another output sink (e.g. the headphones). As said, this seem to work fine for streams that are directly generated on the thin client (e.g. via ‘cat /dev/urandom | pacat’ or via xfreerdp connections), but streams generated via ThinLinc cannot be moved and are rejected with an “invalid argument” error message.

After some investigation, it seems that sink inputs generated via thinlinc are not movable as they carry the DONT_MOVE flag. You can see the output of list-sink-inputs here:

— cut here — 
fwpnuc33:~$ pacmd list-sink-inputs
>>> 1 sink input(s) available.
    index: 0
	driver: <protocol-native.c>
	flags: DONT_MOVE 
	state: CORKED
	sink: 0 <alsa_output.pci-0000_00_03.0.hdmi-stereo-extra1>
	volume: 0: 100% 1: 100%
	        0: 0,00 dB 1: 0,00 dB
	        balance 0,00
	muted: no
	current latency: 159,00 ms
	requested latency: 24,99 ms
	sample spec: s16le 2ch 44100Hz
	channel map: front-left,front-right
	             Stereo
	resample method: (null)
	module: 9
	client: 0 <ThinLinc Client>
	properties:
		media.name = "Built-in Audio Digital Stereo (HDMI) for tsuser at fwpnuc33"
		media.role = "abstract"
		application.name = "ThinLinc Client"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "28"
		application.icon_name = "thinlinc-client"
		application.process.id = "2534"
		application.process.user = "tsuser"
		application.process.host = "fwpnuc33"
		application.process.binary = "pulseaudio"
		application.language = "de_DE.UTF-8"
		window.x11.display = ":0.0"
		application.process.machine_id = "902a406796be73a15e8f43570000001a"
		module-stream-restore.id = "sink-input-by-media-role:abstract”
— cut here —

As we are by no means pulseaudio experts we are wondering if there is a possibility to tune the ThinLinc’ own pulseaudio daemon to start so that the local pulseaudio daemon running on the thin client will be allowed to move a sink input. And if so, instructions to do so would be very helpful.

Furthermore, please note that I even tried to reproduce the same on a standard Ubuntu/Linux system. If you are running a ThinLinc session with some audio output there it is impossible to move the currently playing audio output to another local output device. Thus, even Ubuntu/Linux+ThinLinc seem to suffer from the same problem: You have to reconnect your ThinLinc session if you want to switch audio output devices e.g. to/from your headphones.

And suggestions?

best regards,
jens
-- 
Dr. Jens Maus
Helmholtz-Zentrum Dresden-Rossendorf
Institute of Radiopharmaceutical Cancer Research
Department of Positron Emission Tomography
POB 51 01 19, 01314 Dresden, Germany
http://www.hzdr.de/ | +49 351 260 2757

Board of Directors:
Prof. Dr. Dr. h. c. Roland Sauerbrey,
Prof. Dr. Dr. h. c. Peter Joehnk,
VR 1693 beim Amtsgericht Dresden

(Please note a real name change effective since 5.9.2013.
Former name: Jens Langner)

*** Content is authentic only with digital signature  ***

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4726 bytes
Desc: not available
URL: <http://lists.cendio.se/pipermail/thinlinc-technical/attachments/20140116/ce9c5e34/attachment-0004.p7s>


More information about the Thinlinc-technical mailing list