From e7a665e043a2b82cad2d61189935898d1d46f0ff Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 2 Dec 2025 06:16:18 +0900 Subject: [PATCH] internal/pipewire: handle Core::Error This event is not encountered in the pw-container sample, but already has existing sample from an excerpt. Signed-off-by: Ophestra --- internal/pipewire/core.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/pipewire/core.go b/internal/pipewire/core.go index fe7fb78..671bbd5 100644 --- a/internal/pipewire/core.go +++ b/internal/pipewire/core.go @@ -206,6 +206,14 @@ type CoreError struct { Message String `json:"message"` } +func (c *CoreError) Error() string { + return "received Core::Error on" + + " id " + strconv.Itoa(int(c.ID)) + + " seq " + strconv.Itoa(int(c.Sequence)) + + " res " + strconv.Itoa(int(c.Result)) + + ": " + c.Message +} + // Size satisfies [KnownSize] with a value computed at runtime. func (c *CoreError) Size() Word { return SizePrefix + @@ -543,6 +551,13 @@ func (core *Core) consume(opcode byte, files []int, unmarshal func(v any) error) // anything, and this behaviour is never mentioned in documentation return nil + case PW_CORE_EVENT_ERROR: + var coreError CoreError + if err := unmarshal(&coreError); err != nil { + return err + } + return &coreError + case PW_CORE_EVENT_BOUND_PROPS: var boundProps CoreBoundProps if err := unmarshal(&boundProps); err != nil {