Repository navigation
feat(audio): hear the host computer's sound on the sending device - #28
Merged
Merged
Conversation
The Pi captures the UAC2 gadget's speaker (what the host plays) as Opus RTP and sends it to the on-air client when its offer's audio is sendrecv. /send and the Studio send dialog get an off-by-default "Play the computer's sound here" switch; older sendonly clients are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K4B4YKMC6fT9oWCCwWgt9S
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: the USB speaker enumerated on the host, but anything the host played into it went nowhere. Someone using their phone as the call's mic and camera couldn't hear the call through it.
After:
/sendand the Studio send dialog have a "Play the computer's sound here" switch (off by default; the hint suggests headphones to avoid echo). When it's on, the on-air device plays what the host sends to the GadgetCast speaker.How: a new
GstSourcesupervisesalsasrc (UAC2 capture) → opusenc → rtpopuspay → udpsink, and the bridge forwards those packets withWriteSpeakerRTP. WithOptions.Speaker, an offer whose audio issendrecvgets an Opus track in the answer. Packets go only to the on-air client's track. Sendonly offers (older clients, or the switch off) are answered exactly as before. In the browser,SenderDeps.playturns the audio transceiver into sendrecv. Playback starts inside the Start tap, because phones block audio that doesn't start from a gesture. New flag:-speaker-device(defaultplughw:UAC2Gadget).Test level:
GstSourcedelivery and the pipeline string. Two vitest cases cover the direction and play/stop behaviour.go test -racepasses; media coverage is 90.9%./sendwith a stub gst-launch sending Opus RTP. With the switch on, the phone received 112 host-audio packets in 2s; with it off, it received 0. Mic and camera still reach the pipeline, and axe reports 0 violations on both send UIs.Gate (local): gofmt, vet, build,
go test -race ./..., armv6 and arm64 cross-builds, tsc, vitest (66), vite build.Generated by Claude Code