mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
Extract the ICE candidate buffering, answer routing, and renegotiation glare logic from CallController into a platform-independent PeerSessionManager in commons/. This makes the three most critical NIP-AC spec requirements testable as JVM unit tests with FakePeerSession: 1. Two-layer ICE candidate buffering (global + per-session) - Global buffer: candidates arriving before any PeerConnection exists - Per-session buffer: candidates arriving before setRemoteDescription - Candidates buffered while ringing are preserved when accepting 2. Renegotiation glare handling (pubkey comparison tiebreaker) - Higher pubkey wins, lower pubkey rolls back local offer - Full glare scenario test with two PeerSessionManagers 3. Callee-to-callee mesh initiation (lower pubkey initiates) CallController now delegates to PeerSessionManager via a PeerSession interface, with WebRtcPeerSessionAdapter bridging to WebRtcCallSession. https://claude.ai/code/session_01AfRYTRCvtKqqDxeKQujUrx