aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pipewire/header_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-29 23:23:19 +0900
committerOphestra <cat@gensokyo.uk>2025-11-29 23:25:29 +0900
commit4fd6d6c037b30b02aff861542721b0cc40f083fe (patch)
tree1677c4cc52e4d6d84b43d5aaebb1a5c7e61c28b8 /internal/pipewire/header_test.go
parentde3fc7ba381988c06fdbb0be8446b8e8d2e75af4 (diff)
internal/pipewire: implement Core::Ping, Core::Pong
I could not get the server to produce these events, however I am confident enough with the implementation to do it by hand. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/header_test.go')
-rw-r--r--internal/pipewire/header_test.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/internal/pipewire/header_test.go b/internal/pipewire/header_test.go
index f0bd20d0..8dc58b94 100644
--- a/internal/pipewire/header_test.go
+++ b/internal/pipewire/header_test.go
@@ -335,6 +335,56 @@ func TestHeader(t *testing.T) {
Opcode: pipewire.PW_CORE_EVENT_DONE,
Size: 0x28, Sequence: 44, FileCount: 0,
}, nil},
+
+ /* handmade samples */
+
+ {"PW_CORE_EVENT_PING", []byte{
+ /* Id: */ 0, 0, 0, 0,
+ /* size: */ 0xed, 0xb, 0,
+ /* opcode: */ 2,
+ /* seq: */ 0xff, 0xff, 0, 0,
+ /* n_fds: */ 0xfe, 0xca, 0, 0,
+ }, pipewire.Header{
+ ID: pipewire.PW_ID_CORE,
+ Opcode: pipewire.PW_CORE_EVENT_PING,
+ Size: 0xbed, Sequence: 0xffff, FileCount: 0xcafe,
+ }, nil},
+
+ {"PW_CORE_EVENT_ERROR", []byte{
+ /* Id: */ 0, 0, 0, 0,
+ /* size: */ 0xad, 0xb, 0,
+ /* opcode: */ 3,
+ /* seq: */ 0xfe, 0xfe, 0, 0,
+ /* n_fds: */ 0xfe, 0xca, 0, 0,
+ }, pipewire.Header{
+ ID: pipewire.PW_ID_CORE,
+ Opcode: pipewire.PW_CORE_EVENT_ERROR,
+ Size: 0xbad, Sequence: 0xfefe, FileCount: 0xcafe,
+ }, nil},
+
+ {"PW_CORE_METHOD_PONG", []byte{
+ /* Id: */ 0, 0, 0, 0,
+ /* size: */ 0xed, 0xb, 0,
+ /* opcode: */ 3,
+ /* seq: */ 0xff, 0xff, 0, 0,
+ /* n_fds: */ 0xfe, 0xca, 0, 0,
+ }, pipewire.Header{
+ ID: pipewire.PW_ID_CORE,
+ Opcode: pipewire.PW_CORE_METHOD_PONG,
+ Size: 0xbed, Sequence: 0xffff, FileCount: 0xcafe,
+ }, nil},
+
+ {"PW_CORE_METHOD_ERROR", []byte{
+ /* Id: */ 0, 0, 0, 0,
+ /* size: */ 0xad, 0xb, 0,
+ /* opcode: */ 4,
+ /* seq: */ 0xfe, 0xfe, 0, 0,
+ /* n_fds: */ 0xfe, 0xca, 0, 0,
+ }, pipewire.Header{
+ ID: pipewire.PW_ID_CORE,
+ Opcode: pipewire.PW_CORE_METHOD_ERROR,
+ Size: 0xbad, Sequence: 0xfefe, FileCount: 0xcafe,
+ }, nil},
}.run(t)
t.Run("size range", func(t *testing.T) {