aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pipewire/pipewire.go
AgeCommit message (Collapse)Author
2026-03-30all: use filepathOphestra
This makes package check portable, and removes nonportable behaviour from package pkg, pipewire, and system. All other packages remain nonportable due to their nature. No latency increase was observed due to this change on amd64 and arm64 linux. Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-03-17all: raise timeout defaultsOphestra
This avoids timing out on systems running very slowly. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-19internal/pipewire: EPOLL_CTL_ADD instead of EPOLL_CTL_MODOphestra
Implementation is no longer tied down by the limitations of SyscallConn. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-19internal/pipewire: hold socket fd directlyOphestra
The interface provided by net is not used here and is a leftover from a previous implementation. This change removes it. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-19internal/pipewire: inform conn of blocking intentOphestra
The interface does not expose underlying kernel notification mechanisms. This change removes the need to poll in situations were the next call might block. This is made cumbersome by the SyscallConn interface left over from a previous implementation, it will be replaced in a later commit as the current implementation does not make use of any net.Conn methods other than Close. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-18internal/pipewire: sendmsg/recvmsg errors are fatalOphestra
When returned wrapped as a syscall error, these are impossible to recover from, so wrap them as a fatal error. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-14internal/pipewire: reorder context structOphestra
This change reorders and groups struct elements. This improves readability since this struct holds a lot of state loosely related to each other. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-14internal/pipewire: implement Core::DestroyOphestra
This change also implements pending destructible check on Sync. Destruction method should always be implemented as a wrapper of destructible.destroy. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-14internal/pipewire: move Core wrapper methods under CoreOphestra
These do not belong under Context, and is an early implementation limitation that carried over. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-13internal/pipewire: implement Core::RemoveIdOphestra
This is emitted by the server when a proxy id is removed for any reason. Currently, the only path for this to be emitted is when a global object is destroyed while some proxy is still bound to it. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-11internal/pipewire: generic Core::Error handlingOphestra
This flushes message buffer before queueing the event expecting the error. Since this is quite useful and relatively complex, it is relocated to a method of Context. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-11internal/pipewire: export Registry::DestroyOphestra
This handles the error returned by Sync. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-09internal/pipewire: expose connection propsOphestra
Unused in hakurei but could be useful when the package is moved out of internal. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-09internal/pipewire: include remaining size in recvmsg wrapperOphestra
This otherwise truncates the received data by len(remaining) bytes. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-09internal/pipewire: reset per-roundtrip state once per callOphestra
This was left in consume when relocating per-roundtrip code out of the per-receive consume method. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-09internal/pipewire: increment remote sequence after establishing boundsOphestra
This avoids incrementing it twice proceeding from a partial message. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-09internal/pipewire: do not clobber error parsing SCMsOphestra
The error is handled later, clobbering it here breaks error handling when SCMs are present. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-09Revert "internal/pipewire: work around remote sequence quirk"Ophestra
This reverts commit 564db6863b8e0e90cbf7210152c53124fddc1b4c.
2025-12-08internal/pipewire: work around remote sequence quirkOphestra
Remote sequence sometimes start with a non-zero value, and keeps the same value for a while before going back to zero. Conditions for reproducing this behaviour is not yet known. This change works around this behaviour. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-07internal/pipewire: constant for PIPEWIRE_REMOTEOphestra
This is not defined anywhere in upstream PipeWire, no idea why. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-07internal/pipewire: seq access method for consumeOphestra
This improves readability as the offset is not immediately obvious. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-07internal/pipewire: respond to Core::PingOphestra
There is currently no known message that will get the PipeWire server to emit this event. It should be handled regardless. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-07internal/pipewire: specify opcode and file count with messageOphestra
This adds checking of FileCount while writing a message. Message encoding is relocated to an exported method to be used externally, probably for test stubbing. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-07internal/system: port connect by nameOphestra
This behaviour is a bit messy and checks what appears to be a windows-specific environment variable for some reason. Keeping everything intact regardless to match upstream behaviour. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-06internal/pipewire: check pending ids after doneOphestra
This is not guaranteed to have completed after a roundtrip. This is leftover from when Roundtrip also sent and waited for sync. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-06internal/pipewire: post-sync cleanup functionsOphestra
This makes it easier to handle resources who only needs to stay alive before the next sync. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-06internal/pipewire: handle dangling files in roundtripOphestra
This should not be handled on every receive as it could cause valid (though impossible in current upstream implementation) messages to be rejected and raise a protocol error. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-06internal/pipewire: store proxy errors in contextOphestra
This change fixes handling of non-fatal errors during a roundtrip as there can be multiple receive calls per roundtrip. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-06internal/pipewire: set errno on an empty messageOphestra
This matches upstream behaviour. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-06internal/pipewire: rename context consume methodOphestra
This name is more correct since it does not roundtrip, but receives messages. This is also more consistent with the method on event proxies. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-06internal/pipewire: use sendmsg/recvmsg directlyOphestra
The PipeWire protocol does not work with Go abstractions. This change makes relevant methods call sendmsg/recvmsg directly. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-05internal/pipewire: do not send ancillary msg without filesOphestra
This is unnecessary and does not match upstream behaviour. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-03internal/pipewire: relocate constantsOphestra
This should make things easier to navigate, and possible to fully automatically generate the constants in the future. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-03internal/pipewire: finalizers for dangling filesOphestra
This makes their handling much less error-prone. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-03internal/pipewire: collect non-protocol errorsOphestra
These errors are recoverable and should not terminate event handling. Only terminate event handling for protocol errors or inconsistent state that makes further event handling impossible. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-02internal/pipewire: fail on unacknowledged proxiesOphestra
These proxies (with special cases documented in the implementation) are only safe for use after acknowledgement from the server. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-12-02internal/pipewire: implement client contextOphestra
This consumes the entire sample, is validated to send identical messages and correctly handle received messages. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-29internal/pipewire: implement SecurityContext::CreateOphestra
This is finally the thing we are after. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-27internal/pipewire: add missing constantsOphestra
These did not appear useful at first since it was assumed to be filenames for loading modules. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Client::UpdatePropertiesOphestra
This is the second message on the captured sample. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-25internal/pipewire: implement Core::HelloOphestra
This implements enough types to correctly marshal and unmarshal Core::Hello. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-24internal/pipewire: add type constantsOphestra
This change also centralises encoding testing. Signed-off-by: Ophestra <cat@gensokyo.uk>
2025-11-23internal/pipewire: implement message headerOphestra
Test cases are from interactions between pw-container and PipeWire. Results are validated against corresponding body. Signed-off-by: Ophestra <cat@gensokyo.uk>