Outgoing audio lost after a fast reconnect while the call stays "connected"
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- audio-video-rtc, backend-api-design, mobile-dev
Direzione di ricerca
Start with the reconnect and publisher connection paths named in packages/stream_video/lib/src/call/call.dart, call/session/call_session.dart, webrtc/peer_connection.dart, and ws/ws.dart. Trace how offline renegotiation, peer connection state checks, SFU socket closes, and SFU errors interact during fast reconnects; the report identifies all five gaps and reproduction logs. Reproduce with repeated 10–20 second network outages in a two participant audio call, then verify outgoing audio recovers and reconnect errors trigger the appropriate recovery.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
After a ~10–20 s network drop, stream_video 1.7.2 reports the call reconnected while the publisher peer connection is not actually sending. Others can't hear the user for several seconds at best; in both of our captured runs the user's outgoing audio never came back before the call was dropped. Throughout, CallStatus is connected and the mic shows on.
Environment
| Item | Value |
|---|---|
stream_video / stream_video_flutter |
1.7.2, git ref 2ec78303dbc6fe8043e104b4cd378d56b2159a4e (no reconnect changes on main since) |
stream_webrtc_flutter |
4.0.1 |
| Platform | iOS on a mobile network, CallKit, ADM-level mute (stopTrackOnMute: false) |
| Call | audio only, 2 participants |
| Join options | camera and mic disabled on join, mic enabled right after via setMicrophoneEnabled |
CallPreferences |
reconnectTimeout and networkAvailabilityTimeout set to 30 s |
Impact
- Local user:
CallStatusis connected and the mic shows on, but the other participant hears nothing. Incoming audio works. - Other participants: the user is shown as unmuted; the SFU still lists their audio track as published.
- Recovery: none in either run. Run 1: publisher stuck in ICE
checkinguntil a later network stall ended the call. Run 2: the SFU closed the signaling socket and removed the participant, and the call was dropped 75 s after the outage began. - It reproduces with the mic on during the outage, and with the mic off during the outage and turned on afterwards.
Run 1: publisher stuck in checking
SFU session 30d15c56-3a33-4a48-ae82-830d4bb6711d, two ~20 s outages in the same call. Both were fast reconnects; the second differs only in that a stale publisher negotiation from the offline retry loop succeeded after the network returned.
| Step | Outage 1 (audio recovered) | Outage 2 (audio stayed dead) |
|---|---|---|
| Network lost | 20:53:50 | 20:54:40 |
Publisher ICE restarted while offline (_tryRestartIce, isReconnecting: false) |
20:53:59 | 20:54:50 |
Publisher renegotiation retries while offline, each failing SetPublisher on DNS |
~8 | ~210 in 6 s |
Last retry's SetPublisher |
timed out after 10 s (20:54:11) | succeeded at 20:54:59.27, answer applied |
| Network back | 20:54:11 | 20:54:57 |
Fast reconnect: SFU join reconnected: true, audio still listed as published |
20:54:12 | 20:55:00 |
| Fast reconnect: ICE restart + publisher renegotiation answer | 20:54:13.98 | 20:55:03.23 |
[join] connected |
20:54:14.31 | 20:55:03.25 |
Peer connections reach connected |
both (20:54:12.5, 20:54:14.5) | one only (subscriber), 20:55:06.75 |
publisherConnectionCheck (15 s later) |
Connected — OK |
Checking — OK (20:55:20) |
| SFU error | none | participantMediaTransportFailure: publisher PC: connection failed, strategy rejoin (20:55:20.245) |
| SDK reaction | none needed | rejected rejoin (reconnect in progress: fast); a network-triggered fast reconnect had started 24 ms earlier |
| Outcome | audio works | no outgoing audio; call left at 20:55:50 with ReconnectionFailed after a further network stall |
Run 2: SFU closes the socket, SDK ignores it
SFU session 4372aadf-fa79-49e0-bda8-bdc878c4635c, one ~12 s outage. The mic was muted before the outage (21:46:25) and turned on again after the reconnect. The network also switched from cellular to Wi-Fi during the reconnect.
| Time | Event |
|---|---|
| 21:46:36 | Network lost, fast reconnect started (waits for network) |
| 21:46:44 | Publisher ICE restarted while offline (isReconnecting: false) |
| 21:46:44 → 21:46:48.7 | 152 publisher renegotiations, each failing SetPublisher on DNS; the last one sent 70 ms before the network returned |
| 21:46:50.00 | Fast reconnect begins (setReconnecting(true)) |
| 21:46:50.04 | The stale SetPublisher from the offline loop succeeds; its answer is applied during the fast reconnect |
| 21:46:51.97 | Network changes from cellular to Wi-Fi |
| 21:46:53.18 | Fast reconnect's own publisher renegotiation answered |
| 21:46:53.19 | [join] connected |
| 21:46:53.44 | First peer connection connected |
| 21:46:55.6 → 21:46:58.6 | User unmutes and speaks; UpdateMuteStates and trackPublished succeed, the other participant hears nothing |
| 21:47:01.29 | Second peer connection connected, 8 s after [join] connected |
| 21:47:08 | publisherConnectionCheck: Connected — OK |
| 21:47:20.79 | SFU closes the signaling WebSocket with 1001 closing. The SDK logs SfuSocketDisconnected and does nothing: 1001 counts as an intentional closure |
| 21:47:20 → 21:47:35 | Call still connected with no signaling channel |
| 21:47:35.78 | Both peer connections go ICE disconnected |
| 21:47:35.9 | Coordinator call.session_participant_left for this user |
| 21:47:38.5 | ICE restart triggers a fast reconnect; WS recreated, join request sent |
| 21:47:38.80 | SFU: participantNotFound, strategy rejoin, socket closed 1008 participant 10931 not found. SDK: skipping reconnect (join in progress) |
| 21:47:38 → 21:48:08 | Fast reconnect keeps waiting for a JoinResponse that will never come |
| 21:48:08.74 | fastReconnect failed: TimeoutException after 0:00:30; reconnect window exceeded, call left with ReconnectionFailed |
Root cause
Five gaps combine. Paths are under packages/stream_video/lib/src/ at 2ec78303.
- ICE restarts and renegotiation run while waiting for the network.
_reconnectwaits for the network before running a strategy (call/call.dart:2521), and onlyfastReconnectmarks the peer connections as reconnecting (call/session/call_session.dart:488-489)._tryRestartIce(webrtc/peer_connection.dart:143) and_onRenegotiationNeeded(webrtc/peer_connection.dart:556) are guarded only by that flag, so they fire ondisconnected/failedwhile offline.- Each publisher negotiation fails
SetPublisher(call/session/call_session.dart:1187) and rolls back; the pending ICE restart re-firesnegotiationneeded, giving a tight loop (150–210 offers in 4–6 s, each with new ICE credentials and a burst of trickle requests). - The last request can complete after the network returns, even after the fast reconnect has started (run 2), so the SFU applies an ICE-restart offer outside the reconnect and the fast reconnect then renegotiates again on top of it.
- A fast reconnect reports connected before media is up.
fastReconnectrestarts ICE and renegotiates the publisher (call/session/call_session.dart:565-571), then_joinsets the call connected (call/call.dart:1880). Nothing waits for either peer connection to reachconnected: 3 s (run 1, never) and 8 s (run 2) after[join] connected, media was still not flowing. - No recovery for a publisher stuck in
checking.startPublisherConnectionCheck(call/session/call_session.dart:619-677) handles only ICEnewand signalinghave-local-offer; any other state is logged as OK, includingchecking17 s after the last answer (run 1).- The SFU does detect the failure and asks for a rejoin, but
_reconnectdrops it while another reconnect holds the lock (call/call.dart:2406). It is only kept as_isRejoinPendingfor when the current attempt fails (call/call.dart:2445); if that attempt "succeeds" on signaling, the stuck publisher stays.
- An SFU-initiated
1001close is ignored.StreamWebSocketCloseCode.isIntentionalClosuretreatsgoingAway(1001) likenormalClosure(ws/ws.dart:49-50), so theSfuSocketDisconnectedhandler skips reconnecting (call/call.dart:2302-2306). That fits a client-side close, but here the SFU closed the socket (manuallyClosed: false) and the call sat without signaling until the SFU removed the participant 15 s later (run 2). - A fast reconnect ignores an SFU error and waits 30 s.
start()races the join response againstSfuErrorEvent(call/session/call_session.dart:329-333), butfastReconnectwaits only forSfuJoinResponseEventwith a 30 s limit (call/session/call_session.dart:543). OnparticipantNotFoundthe SFU replies at once and closes the socket, yet the attempt runs the full 30 s; the rejoin the SFU asked for is deferred (call/call.dart:2397) and, with a 30 sreconnectTimeout, never runs (call/call.dart:2489).
Why the publisher's ICE stalled after the double negotiation, and why the SFU closed the socket at 21:47:20 in run 2, need the SFU's side of the two sessions above. On the client, the final answers and the SFU's publisher candidates arrived and were applied.
Steps to reproduce
Intermittent: it depends on the last offline SetPublisher completing after the network returns. Two or three outages in a row raise the odds.
- Join a 2-person audio call on a phone (reproduced on iOS; the code path is shared across platforms). Turn the mic on, or leave it off and turn it on after step 2.
- Turn mobile data / Wi-Fi off for 10–20 s, then back on. Wait for the call to show connected.
- Repeat step 2 once or twice.
- Speak: the other participant hears nothing although the call shows connected and the mic on.
- With verbose SDK logs, confirm:
[negotiate] #setPublisher; failedrepeated while offline, a[setRemoteAnswer] #publisherright before or during[fastReconnect], then either[publisherConnectionCheck] … Checking — OK(run 1) or[Sfu-WS] [onClose] closeCode: 1001with no reconnect (run 2).
- Lingua principale
- Dart
- Stelle
- 79
- Fork
- 55
- Merge medio
- 2g 12h
- PR unite (30g)
- 142
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di GetStream/stream-video-flutter
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
GetStream/stream-video-flutter#1661 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
GetStream/stream-video-flutter#1652 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
GetStream/stream-video-flutter#1621 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
GetStream/stream-video-flutter#1535 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
GetStream/stream-video-flutter#1430 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di GetStream/stream-video-flutter
Issue simili
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 66/100
rajput-hemant/calculator#214 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
leancodepl/marionette_mcp#160 ·
I maintainer di solito rispondono entro 4 giorni
-
claude
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
linagora/tmail-flutter#5180 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
decentespresso/decaid#1257 ·
I maintainer di solito rispondono entro 1 giorno