Compare commits

...

2 Commits

Author SHA1 Message Date
Christian Gick
4ab5486b5c fix(voice): log remote participant identity and track count in E2EE poll
Adds REMOTE_PARTICIPANT log every 10s to confirm caller is present
and tracks are subscribed during E2EE decryption diagnosis.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 10:30:38 +02:00
Christian Gick
c4581c2917 fix(voice): reduce key rotation wait to 2s, increase E2EE poll to every 10s
Phase 2 diagnostics: caller audio arrives immediately; setting the key
earlier (2s vs 10s) avoids dropping initial frames. E2EE_CRYPTOR log
now fires every 10s (was 30s) to confirm decryption state for incoming
caller audio.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 10:27:19 +02:00

View File

@@ -263,7 +263,7 @@ class VoiceSession:
# NOTE: HTTP fetch is useless here — keys are Matrix-E2EE encrypted (m.room.encrypted).
pre_max_idx = max(self._caller_all_keys.keys()) if self._caller_all_keys else -1
logger.info("Waiting for EC key rotation via nio sync (current max_idx=%d)...", pre_max_idx)
for _attempt in range(20): # up to 10s (20 × 0.5s)
for _attempt in range(4): # up to 2s (4 × 0.5s)
await asyncio.sleep(0.5)
new_max = max(self._caller_all_keys.keys()) if self._caller_all_keys else -1
if new_max > pre_max_idx:
@@ -271,10 +271,10 @@ class VoiceSession:
logger.info("Key rotated: index %d%d (%d bytes)",
pre_max_idx, new_max, len(self._caller_key))
break
if _attempt % 4 == 3: # log every 2s
logger.info("Key rotation wait %ds: max_idx still %d", (_attempt + 1) // 2, new_max)
if _attempt % 2 == 1: # log every 1s
logger.info("Key rotation wait %0.1fs: max_idx still %d", (_attempt + 1) * 0.5, new_max)
else:
logger.warning("No key rotation after 10s — using pre-join key[%d]", pre_max_idx)
logger.warning("No key rotation after 2s — using pre-join key[%d]", pre_max_idx)
# Set per-participant keys via key provider — pass raw base keys.
# KDF_HKDF=1: Rust FFI applies HKDF(base_key, ratchetSalt, ...) internally.
@@ -367,7 +367,7 @@ class VoiceSession:
while True:
await asyncio.sleep(5)
_poll_count += 1
if _poll_count % 6 == 0: # Every 30s
if _poll_count % 2 == 0: # Every 10s
try:
cryptors = self.lk_room.e2ee_manager.frame_cryptors()
for c in cryptors:
@@ -375,6 +375,10 @@ class VoiceSession:
c.participant_identity, c.key_index, c.enabled)
except Exception as e:
logger.debug("frame_cryptors() failed: %s", e)
# Log E2EE state for all remote participants
for p in self.lk_room.remote_participants.values():
logger.info("REMOTE_PARTICIPANT: identity=%s tracks=%d",
p.identity, len(p.track_publications))
except asyncio.CancelledError:
logger.info("Session cancelled for %s", self.room_id)