pulseaudio-module-xrdp icon indicating copy to clipboard operation
pulseaudio-module-xrdp copied to clipboard

Does xrdp sink make any compression of audio stream?

Open Serg-VL opened this issue 2 years ago • 13 comments

I see it's totally unusable to listen audio. Every move of any window inerrupts sound! May be I've built it with wrong flags?

Serg-VL avatar Nov 15 '23 13:11 Serg-VL

It defaults no compression, we should look into maybe changing that. --enable-mp3lame for mp3 compression and --enable-fdkaac for aac compression. --enable-opus is there too but that is not part of the Microsoft standard and only works on client that have that special support.

jsorg71 avatar Nov 15 '23 20:11 jsorg71

Thank you! I've built xrdp with both flags --enable-mp3lame and --enable-fdkaac How could I determine that any of codecs used in my connection?

Serg-VL avatar Nov 16 '23 10:11 Serg-VL

You should be able to see it in the bandwidth being used. Uncompressed PCM stereo will use around 150kb/s (which is quite exactly the bandwidth usage I see right now when audio is playing, plus some 25kb/s for nothing really moving on the desktop).

Using mp3 should be way lower (10-20% maybe, not sure how the quality and bitrate settings are controlled for xrdp-sink). You need some kind of network monitor to tell the bandwidth usage. "Conky" on the Linux side or "Net Speed Monitor" on the Windows side (it's a task bar widget) give very precise readings e.g..

tbone2k-git avatar Apr 09 '24 18:04 tbone2k-git

Where is the place to set the "--enable-mp3lame" or "--enable-fdkaac" flags? I grepped and looked through alot of places and files. I cannot find how and where to enable the mp3lame compression for building the xrdp-sink. I'm not much of a Linux professional, "make --enable-mp3lame" did not work either.. o(

Can you tell me? Thank you! o)

tbone2k-git avatar Apr 09 '24 18:04 tbone2k-git

You can use those parameters to configure xrdp. The compression is done in xrdp(chansrv). ./configure --enable-mp3lame --enable-fdkaac then run make.

jsorg71 avatar Apr 09 '24 19:04 jsorg71

Hi jsorg71! o)

I tried that and I got this message, so I assumed this is not the way to go: configure: WARNING: unrecognized options: --enable-mp3lame, --enable-fdkaac

Thank you nonetheless, any help is appreciated! o)

Full output looks like this: op3@debian:~/pulseaudio-module-xrdp$ ./configure --enable-mp3lame --enable-fdkaac

configure: WARNING: unrecognized options: --enable-mp3lame, --enable-fdkaac
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking for ar... ar
checking the archiver (ar) interface... ar
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of gcc... gcc3
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for gawk... (cached) mawk
checking for gcc... (cached) gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to enable C11 features... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking how to run the C preprocessor... gcc -E
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for libpulse... yes
## -------------------------------------------------------------- ##
## PULSE_DIR not specified. Follow the instructions in README.md. ##
## -------------------------------------------------------------- ##
configure: error: PULSE_DIR not specified

tbone2k-git avatar Apr 09 '24 21:04 tbone2k-git

@tbone2k-git - those flags are required to build xrdp, not the module.

The data flow goes from the sink to chansrv (local connection) and from there via xrdp over the network (remote connection). The compression is not done in the sink as this would potentially hold up other sound server events.

matt335672 avatar Apr 10 '24 08:04 matt335672

Hi Mat! o)

Ok, interesting. So I need to compile the full xrdp "thing" somehow and find out how and where to deploy the compile/build artefacts? Man, I was hoping things get easier from some point on.. o) I have to research how to do all this..

Thank you for your kind help! o)

tbone2k-git avatar Apr 10 '24 17:04 tbone2k-git

Some hours later..

I need to uninstall the xrdp package before being able to compile / deploy it with make (I read in the docs). I currently use the packaged xrdp to work on the Linux desktop, I would need to switch to SSH then I guess, at least temporarily.

I also had problems when installing all the dependencies, I used these links for help: https://github.com/neutrinolabs/xrdp/wiki#building-from-sources https://github.com/neutrinolabs/xrdp/wiki/Building-on-Debian-8

Package "python-libxml2" does not exist on Debian12. I just swapped it for "python3-libxml2", but not sure how this works out in the later process.

Finally.. just throwing in "--enable-mp3lame, --enable-fdkaac" is probably not enough to have a somewhat rich xrdp experience. There are a lot more options in the "./configure" script, I am not sure which one were enabled for the xrdp package I use right now, which was installed via "apt install". So, I have a lot of guess work to do, before ending up with something that has more features than before?

Most of the options default to "no", I don't really understand why that is, is it because to use all the other options, the list of dependencies and additionally required packages would grow exponentially? I guess so? Would I be able to compile all the options available? Even more questions.. o)

image

Thank you all, I think I have to give up at this point! o(

Getting the audio compression to work, is icing on the case anyway I guess. I'm still happy I have any audio signal now at all. I spend days and had multiple attempts of compiling the xrdp sink "myself" (which means by following various existing documentations). For some reason it worked the last time I tried! o)

Thank you all! I mean it! o)

tbone2k-git avatar Apr 10 '24 18:04 tbone2k-git

If anyone likes to encourage me to continue.. I maybe would! o)

Unfortunately, compiling such a huge package and replacing it in the system is probably way over my head. I am a software dev for decades, but not very used to Linux and gcc (not used at all). So, things can get really nasty if I / we continue. o)

tbone2k-git avatar Apr 10 '24 18:04 tbone2k-git

If it's any encouragement, you have build the xrdp pulseaudio sink with is the most difficult. You could clone xrdp, configure it(with --enable-mp3lame, --enable-fdkaac), build and see how easy it is. You don't need to uninstall anything to try just that.

jsorg71 avatar Apr 10 '24 19:04 jsorg71

Ok, the "configure" and "make" ran fine I guess, which raised my hopes! o) I removed the existing xrdp package with "apt remove xrdp" (not sure this was a good move though). Then I ran the "make install" command from the "xrdp" sources directory (which finished okayish I think). I rebooted..

But since then.. no way to get past the sesman login (this is what I end up with). This actually is what I expected to end up with, so.. no disappointment really! o) image

I also removed xordxrdp and xrdp package again and reinstalled with "apt install", but to no avail. Something is broken now and I could not really find anything in the /etc/xrdp/xrdp.log or sesman.log which would indicate what the problem is - sigh! o)

My actual goal (trying and learning for some months now) is to build a custom Linux setup which matches an installed WindowXP in size (800-1000mb) and functionality - some basic distros like this do not seem to exist. Well, there are some weird ones out there using squashfs e.g., nothing you can easily build upon. My last attempt came out at 300mb disk usage (using btrfs + compression) and good working desktop (but no xrdp audio so far).

I guess you don't have a clue what the problem is I have now - which is ok! o) It was worth a try and I actually got further than I expected! o)

Thank you!

tbone2k-git avatar Apr 10 '24 22:04 tbone2k-git

@tbone2k-git - a couple of bit more encouragement for you:-

  1. To find out what options xrdp is built with, simply run xrdp -v and it will tell you.
  2. The above looks like Xorg is missing a path in /etc/xrdp/sesman.ini. Have a look in that file and search for the [Xorg] section. On modern systems you need to replace param=Xorg with something else. Instructions should be in the file.
  3. If that's not it, I'm sure we can figure it out for you.

Good luck with the desktop replacement project - it sounds interesting.

matt335672 avatar Apr 11 '24 10:04 matt335672