Skip to content

Commit 0915b80

Browse files
committed
Fix condition when SFU should try to reconnect
1 parent 118ae6d commit 0915b80

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Packages/StreamVideo/Runtime/Core/LowLevelClient/RtcSession.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@ public Camera VideoSceneInput
213213
}
214214

215215
#endregion
216+
217+
public bool ShouldSfuAttemptToReconnect()
218+
{
219+
if (CallState != CallingState.Joined && CallState != CallingState.Joining)
220+
{
221+
return false;
222+
}
223+
224+
return !GetCurrentCancellationTokenOrDefault().IsCancellationRequested;
225+
}
216226

217227
public string SessionId { get; private set; } = "(empty)";
218228

Packages/StreamVideo/Runtime/Core/LowLevelClient/StreamVideoLowLevelClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public StreamVideoLowLevelClient(IWebsocketClient coordinatorWebSocket, IWebsock
144144

145145
//StreamTodo: move to factory
146146
var coordinatorReconnect = new ReconnectScheduler(_timeService, this, _networkMonitor, shouldReconnect: () => true);
147-
var sfuReconnect = new ReconnectScheduler(_timeService, this, _networkMonitor, shouldReconnect: () => RtcSession.ActiveCall != null);
147+
var sfuReconnect = new ReconnectScheduler(_timeService, this, _networkMonitor, shouldReconnect: () => RtcSession.ShouldSfuAttemptToReconnect());
148148

149149
//StreamTodo: move to factory
150150
_coordinatorWS = new CoordinatorWebSocket(coordinatorWebSocket, coordinatorReconnect, authProvider: this,

0 commit comments

Comments
 (0)