neutrinolabs / pipewire-module-xrdp

MIT License
33 stars 3 forks source link

load_pw_modules.sh uses configuration that doesn't exist #6

Open elboulangero opened 7 months ago

elboulangero commented 7 months ago

While discussing packaging this repo for Debian at https://alioth-lists.debian.net/pipermail/pkg-utopia-maintainers/2024-March/034881.html, there was some feedback from Dylan (maintainer of the pipewire package in Debian):

Some comments about the upstream load_pw_modules.sh

It refers to the Debian wiki which is nice :-) but not sure this is the best reference for pipewire. For example, it uses configuration that doesn't exist, I was asked by upstream to update our wiki about that :-) -- https://wiki.debian.org/PipeWire?action=diff&rev2=49&rev1=48

It is an upstream bug, but I guess they need to refresh their load_pw_modules.sh.

The diff mentioned above is about the removal of default.clock.force-quantum as « force-quantum doesn't exist in context.properties » according to Dylan.

I suppose it wouldn't hurt to run the script load_pw_modules.sh in a console, there should be one (or more) error messages to hint at what needs to be updated.

elboulangero commented 7 months ago

I dumped the output of load_pw_modules.sh to a log file, there's one error that stands out:

+ pw-cli -m -d load-module libpipewire-module-xrdp sink.node.latency=2048 sink.stream.props={node.name=xrdp-sink} source.stream.props={node.name=xrdp-source}
+ pw-metadata -n settings 0 clock.force-quantum 2048
+ pw-metadata -n settings 0 default.clock.force-quantum 4096
+ pw-metadata -n settings 0 default.clock.quantum 4096
[E][02827.931756] default      | [        pw-cli.c:  445 on_core_error()] remote 0x56110aa7c8e8: error id:68 seq:137 res:-2 (No such file or directory): no global 66
[E][02827.931786] default      | [        pw-cli.c:  445 on_core_error()] remote 0x56110aa7c8e8: error id:0 seq:139 res:-2 (No such file or directory): unknown resource 68 op:7
+ pw-metadata -n settings 0 default.clock.min-quantum 4096
+ pw-metadata -n settings 0 default.clock.rate 44100

Seemingly pw-metadata -n settings 0 default.clock.quantum 4096 returns an error.

However, after that I tried to run the commands above, and this time no error:

┌──(kali㉿kali)-[~]
└─$ pw-metadata -n settings 0 clock.force-quantum 2048
Found "settings" metadata 31
set property: id:0 key:clock.force-quantum value:2048 type:(null)

┌──(kali㉿kali)-[~]
└─$ pw-metadata -n settings 0 default.clock.force-quantum 4096
Found "settings" metadata 31
set property: id:0 key:default.clock.force-quantum value:4096 type:(null)

┌──(kali㉿kali)-[~]
└─$ pw-metadata -n settings 0 default.clock.quantum 4096 
Found "settings" metadata 31
set property: id:0 key:default.clock.quantum value:4096 type:(null)

┌──(kali㉿kali)-[~]
└─$ pw-metadata -n settings 0 default.clock.min-quantum 4096
Found "settings" metadata 31
set property: id:0 key:default.clock.min-quantum value:4096 type:(null)

Maybe there's a race, since as we can see here:

https://github.com/neutrinolabs/pipewire-module-xrdp/blob/e9c6c05dd4327fca43d8861535c1f75c9b258aef/instfiles/load_pw_modules.sh#L46-L53

pw-cli -m -d load-module is called and sent to background, and then we have a sleep 1... So maybe the pw-metadata commands are called too early after that....

I tried a few times to log in and out, and it's not 100% reproducible. Sometimes there's no error, sometimes there are more errors, and the output suggests that, for some reason, we don't get stderr in time, so we don't know which command caused it. Example:

+ pw-cli -m -d load-module libpipewire-module-xrdp sink.node.latency=2048 sink.stream.props={node.name=xrdp-sink} source.stream.props={node.name=xrdp-source}
+ pw-metadata -n settings 0 clock.force-quantum 2048
+ pw-metadata -n settings 0 default.clock.force-quantum 4096
[E][02961.843375] default      | [        pw-cli.c:  445 on_core_error()] remote 0x55d5f9d278e8: error id:69 seq:137 res:-2 (No such file or directory): no global 67
[E][02961.843411] default      | [        pw-cli.c:  445 on_core_error()] remote 0x55d5f9d278e8: error id:0 seq:139 res:-2 (No such file or directory): unknown resource 69 op:7
+ pw-metadata -n settings 0 default.clock.quantum 4096
+ pw-metadata -n settings 0 default.clock.min-quantum 4096
+ pw-metadata -n settings 0 default.clock.rate 44100
+ command -v pactl
+ pactl set-default-sink xrdp-sink
+ pactl set-default-source xrdp-source
+ exit 0
[E][02961.839801] default      | [        pw-cli.c:  445 on_core_error()] remote 0x56110aa7c8e8: error id:69 seq:192 res:-2 (No such file or directory): no global 67
[E][02961.840085] default      | [        pw-cli.c:  445 on_core_error()] remote 0x56110aa7c8e8: error id:0 seq:194 res:-2 (No such file or directory): unknown resource 69 op:7

It's all a bit confusing.