Repository navigation
Conversation
Djoko-cli
added a commit
to Djoko-cli/haptool
that referenced
this pull request
Oct 7, 2026
…r, horodatage) La conclusion « piste matérielle » pour le micro était inexacte : firmware figé, rétabli par un redémarrage électrique. Audio vers le haut-parleur et horodatage audio corrigés dans go2rtc (AlexxIT/go2rtc#2551 et #2550). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Djoko-cli
added a commit
to Djoko-cli/haptool
that referenced
this pull request
Oct 12, 2026
…r, horodatage) La conclusion « piste matérielle » pour le micro était inexacte : firmware figé, rétabli par un redémarrage électrique. Audio vers le haut-parleur et horodatage audio corrigés dans go2rtc (AlexxIT/go2rtc#2551 et #2550). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
trackToVideo() selected the resolution only when a consumer requested the video track. A stream started by an audio only consumer (e.g. rtsp://...?audio) sent SelectedRTPStreamConfiguration with a 0x0, 0 fps video, and a Logitech Circle View then sends nothing at all, without any error: the producer stops after the 5 s deadline and reconnects in a loop. The resolution is now selected in every case, with the same rules (largest one within maxwidth/maxheight). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The HomeKit producer now offers a sendonly OPUS/48000/2 media when the camera lists Opus in its SupportedAudioStreamConfiguration. For other cameras GetMedias() is unchanged. Consumer audio is sent to the camera speaker over the audio SRTP session of the stream: - the payload type and RTCP interval selected by go2rtc in SelectedRTPStreamConfiguration are applied to the audio session before AddSession; - the session is used only if it carries Opus and was actually added to the SRTP server; - a stream with only a two-way audio consumer starts too: Opus is requested from the camera and the camera video keeps it alive; - one sender for all consumers keeps the RTP sequence continuous; RTP timestamps are rescaled from 48 kHz to the camera clock rate and stay continuous across talk spurts (gap > 500 ms), with the marker bit on the first packet of a spurt. srtp.Session gets a mutex: the local pion Context has no concurrency protection and is used by WriteRTP (sender goroutine) and WriteRTCP (server goroutine, receiver reports). AddSession takes it while it sets up the session, and writes before AddSession are ignored instead of panicking on a nil conn. Two-way audio is on by default and `#backchannel=0` disables it. Tested with two Logitech Circle View (Opus, 8 kHz). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Djoko-cli
force-pushed
the
pr/homekit-backchannel
branch
from
November 28, 2026 08:13
0072b91 to
1d0b29d
Compare
This branch has not been deployed
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.
Adds two-way audio to the HomeKit client (
homekit://source), only for cameras that support Opus. The speaker of such a camera can be fed by any go2rtc consumer that sends Opus: RTSP?backchannel=1, WebRTC, or stream to camera.The first commit is a separate, pre-existing fix that two-way audio needs: audio-only consumers did not work.
trackToVideo()picked a resolution only when a consumer asked for video. So a stream started byrtsp://…?audio(or by a consumer that only sends audio) asked the camera for 0×0 video at 0 fps. A Circle View then sends nothing at all and returns no error, so the producer stops after the 5 s deadline and reconnects in a loop. The resolution is now picked in every case, with the same rules as before.Scope, given the earlier discussions
SupportedAudioStreamConfiguration. For other camerasGetMedias()is unchanged, sostreamsnever matches or callsAddTrackfor them, and stream to camera fails with the same error as before.core,streamsor ffmpeg, and no custom ffmpeg (see Add bidirectional audio support for HomeKit cameras #1981). There is no transcoding: the consumer's Opus packets are sent as they are, with a rewritten RTP header. (opus.RepackToHAPis not reused: it assumes 20 ms packets at 16 kHz, while the clock rate here is whatever the camera selected.)#backchannel=0disables it. Unlike the RTSP source, which keeps the backchannel only with#backchannel=1once any#parameter is present, here only=0disables it, so#bitrate=...alone keeps two-way audio.How it works
GetMedias()adds a sendonlyOPUS/48000/2media when the camera supports Opus andBackchannelis set.streamHandlersets it by default.Start():SelectedRTPStreamConfigurationto the audio session, beforeAddSession;AddTrack()uses onecore.Senderfor all consumers, the same pattern as the Tapo backchannel. Its handler gives each packet:srtp.Sessiongets a mutex, because the local pionContexthas no concurrency protection. It is used byWriteRTP(sender goroutine) and byWriteRTCP(server goroutine, receiver reports).AddSessiontakes it while it sets up the session. A write beforeAddSessionis ignored instead of panicking on a nilconn.Tests
pkg/homekit/backchannel_test.go: a fake camera endpoint decrypts with the controller key. It checks:Stop();pkg/srtp/session_test.go: no panic beforeAddSession, and concurrentWriteRTPandWriteRTCPunder-race.go test -race ./pkg/homekit/ ./pkg/srtp/passes.#backchanneloption and without the start with only an audio-sending consumer. Two paths play correctly on the camera speakers:Intercomby sending the iPhone audio tortsp://…?backchannel=1;ffmpeg:file#audio=opus).Limitations
core.Nodehas a single parent). If two consumers talk at the same time, their packets are interleaved.🤖 Generated with Claude Code