Skip to content

Commit

Permalink
chore: Add simulate for candidate protocol switch. (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc authored Sep 20, 2022
1 parent e106ce9 commit a60a2e8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions example/lib/exts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,6 @@ enum SimulateScenarioResult {
nodeFailure,
migration,
serverLeave,
switchCandidate,
clear,
}
2 changes: 2 additions & 0 deletions example/lib/widgets/controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ class _ControlsWidgetState extends State<ControlsWidget> {
nodeFailure: result == SimulateScenarioResult.nodeFailure ? true : null,
migration: result == SimulateScenarioResult.migration ? true : null,
serverLeave: result == SimulateScenarioResult.serverLeave ? true : null,
switchCandidate:
result == SimulateScenarioResult.switchCandidate ? true : null,
);
}
}
Expand Down
2 changes: 2 additions & 0 deletions lib/src/core/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,14 @@ extension RoomDebugMethods on Room {
bool? nodeFailure,
bool? migration,
bool? serverLeave,
bool? switchCandidate,
}) async {
engine.signalClient.sendSimulateScenario(
speakerUpdate: speakerUpdate,
nodeFailure: nodeFailure,
migration: migration,
serverLeave: serverLeave,
switchCandidate: switchCandidate,
);
}
}
4 changes: 4 additions & 0 deletions lib/src/core/signal_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -438,13 +438,17 @@ extension SignalClientRequests on SignalClient {
bool? nodeFailure,
bool? migration,
bool? serverLeave,
bool? switchCandidate,
}) =>
_sendRequest(lk_rtc.SignalRequest(
simulate: lk_rtc.SimulateScenario(
speakerUpdate: speakerUpdate,
nodeFailure: nodeFailure,
migration: migration,
serverLeave: serverLeave,
switchCandidateProtocol: (switchCandidate != null && switchCandidate)
? lk_rtc.CandidateProtocol.TCP
: null,
),
));
}
Expand Down

0 comments on commit a60a2e8

Please sign in to comment.