From a55c209099c96101288350043817c5dc50fdb158 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 26 Nov 2025 16:27:46 +0900 Subject: [PATCH] internal/pipewire: additional Client::Info test case This appears to add *one single entry* compared to the message before it. The inefficiency of this protocol is beyond imagination. Signed-off-by: Ophestra --- internal/pipewire/client_test.go | 45 ++++++++++++++++++ internal/pipewire/header_test.go | 6 +++ internal/pipewire/pipewire_test.go | 5 ++ .../testdata/17-recvmsg00-message04-header | Bin 0 -> 16 bytes .../testdata/18-recvmsg00-message04-POD | Bin 0 -> 2000 bytes 5 files changed, 56 insertions(+) create mode 100644 internal/pipewire/testdata/17-recvmsg00-message04-header create mode 100644 internal/pipewire/testdata/18-recvmsg00-message04-POD diff --git a/internal/pipewire/client_test.go b/internal/pipewire/client_test.go index 69a9547..96ea8fa 100644 --- a/internal/pipewire/client_test.go +++ b/internal/pipewire/client_test.go @@ -68,6 +68,51 @@ func TestClientInfo(t *testing.T) { {Key: "settings.check-rate", Value: "false"}, {Key: "core.version", Value: "1.4.7"}, }}}, nil}, + + {"sample**", []byte(recvmsg00Message04POD), pipewire.ClientInfo{ + ID: 34, + ChangeMask: pipewire.PW_CLIENT_CHANGE_MASK_PROPS, + Props: &pipewire.SPADict{NItems: 39, Items: []pipewire.SPADictItem{ + {Key: "pipewire.protocol", Value: "protocol-native"}, + {Key: "core.name", Value: "pipewire-alice-1443"}, + {Key: "pipewire.sec.socket", Value: "pipewire-0-manager"}, + {Key: "pipewire.sec.pid", Value: "1443"}, + {Key: "pipewire.sec.uid", Value: "1000"}, + {Key: "pipewire.sec.gid", Value: "100"}, + {Key: "module.id", Value: "2"}, + {Key: "object.id", Value: "34"}, + {Key: "object.serial", Value: "34"}, + {Key: "remote.intention", Value: "manager"}, + {Key: "application.name", Value: "pw-container"}, + {Key: "application.process.binary", Value: "pw-container"}, + {Key: "application.language", Value: "en_US.UTF-8"}, + {Key: "application.process.id", Value: "1443"}, + {Key: "application.process.user", Value: "alice"}, + {Key: "application.process.host", Value: "nixos"}, + {Key: "application.process.session-id", Value: "1"}, + {Key: "window.x11.display", Value: ":0"}, + {Key: "cpu.vm.name", Value: "qemu"}, + {Key: "log.level", Value: "0"}, + {Key: "cpu.max-align", Value: "32"}, + {Key: "default.clock.rate", Value: "48000"}, + {Key: "default.clock.quantum", Value: "1024"}, + {Key: "default.clock.min-quantum", Value: "32"}, + {Key: "default.clock.max-quantum", Value: "2048"}, + {Key: "default.clock.quantum-limit", Value: "8192"}, + {Key: "default.clock.quantum-floor", Value: "4"}, + {Key: "default.video.width", Value: "640"}, + {Key: "default.video.height", Value: "480"}, + {Key: "default.video.rate.num", Value: "25"}, + {Key: "default.video.rate.denom", Value: "1"}, + {Key: "clock.power-of-two-quantum", Value: "true"}, + {Key: "link.max-buffers", Value: "64"}, + {Key: "mem.warn-mlock", Value: "false"}, + {Key: "mem.allow-mlock", Value: "true"}, + {Key: "settings.check-quantum", Value: "false"}, + {Key: "settings.check-rate", Value: "false"}, + {Key: "core.version", Value: "1.4.7"}, + {Key: "pipewire.access", Value: "unrestricted"}, + }}}, nil}, }.run(t) } diff --git a/internal/pipewire/header_test.go b/internal/pipewire/header_test.go index 20f7ded..56f51c8 100644 --- a/internal/pipewire/header_test.go +++ b/internal/pipewire/header_test.go @@ -59,6 +59,12 @@ func TestHeader(t *testing.T) { Size: 0x7a0, Sequence: 3, FileCount: 0, }, nil}, + {"PW_CLIENT_EVENT_INFO**", []byte(recvmsg00Message04Header), pipewire.Header{ + ID: pipewire.PW_ID_CLIENT, + Opcode: pipewire.PW_CLIENT_EVENT_INFO, + Size: 0x7d0, Sequence: 4, FileCount: 0, + }, nil}, + {"PW_SECURITY_CONTEXT_METHOD_CREATE", []byte{ // Id 3, 0, 0, 0, diff --git a/internal/pipewire/pipewire_test.go b/internal/pipewire/pipewire_test.go index bfdc571..3d2ff05 100644 --- a/internal/pipewire/pipewire_test.go +++ b/internal/pipewire/pipewire_test.go @@ -46,4 +46,9 @@ var ( recvmsg00Message03Header string //go:embed testdata/16-recvmsg00-message03-POD recvmsg00Message03POD string + + //go:embed testdata/17-recvmsg00-message04-header + recvmsg00Message04Header string + //go:embed testdata/18-recvmsg00-message04-POD + recvmsg00Message04POD string ) diff --git a/internal/pipewire/testdata/17-recvmsg00-message04-header b/internal/pipewire/testdata/17-recvmsg00-message04-header new file mode 100644 index 0000000000000000000000000000000000000000..4c4b0f7541adc5506c04d95c0c54c0d3bf4e4bce GIT binary patch literal 16 ScmZQ%U|_hw&cMLJ0096BO#s~h literal 0 HcmV?d00001 diff --git a/internal/pipewire/testdata/18-recvmsg00-message04-POD b/internal/pipewire/testdata/18-recvmsg00-message04-POD new file mode 100644 index 0000000000000000000000000000000000000000..bb28d8248055412314a08e81bedb819bd9434591 GIT binary patch literal 2000 zcmX@X&cMLOz`(!)#Yzkiz`?-4z{0IkUy4P& zfq?3?^=+8;a zOD|1K2PYXGsC;T(d}y#7Yadv)34!U}5e|Nli;E%_-4K&dE>C z)+A`Y*1^*`7WFBqdHJ9y0xN|11D0N4`5zMh1^MNvMY{QEx+UfLr~wWOx00e# za0-EyH#wPk*?ORamQ