Skip to content

Commit

Permalink
update.
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwebrtc committed Nov 23, 2023
1 parent ba47a1c commit 7e83ecc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
16 changes: 12 additions & 4 deletions lib/src/core/engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
'Timed out waiting for SignalResumedEvent'),
);
}
resumeConnection.call(null);
await resumeConnection.call(null);
} catch (e) {
logger.warning('Failed to resume connection: $e');
}
Expand Down Expand Up @@ -702,9 +702,13 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
required lk_rtc.UpdateSubscription subscription,
required Iterable<lk_rtc.TrackPublishedResponse>? publishTracks,
}) async {
final answer = (await subscriber?.pc.getLocalDescription())?.toPBType();
final previousAnswer =
(await subscriber?.pc.getLocalDescription())?.toPBType();
final previousOffer =
(await publisher?.pc.getLocalDescription())?.toPBType();
signalClient.sendSyncState(
answer: answer,
answer: previousAnswer,
offer: previousOffer,
subscription: subscription,
publishTracks: publishTracks,
dataChannelInfo: dataChannelInfo(),
Expand Down Expand Up @@ -833,7 +837,7 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
'Received ${SignalTrickleEvent} but publisher or subscriber was null.');
return;
}
logger.fine('got ICE candidate from peer');
logger.fine('got ICE candidate from peer (target: ${event.target})');
if (event.target == lk_rtc.SignalTarget.SUBSCRIBER) {
await subscriber!.addIceCandidate(event.candidate);
} else if (event.target == lk_rtc.SignalTarget.PUBLISHER) {
Expand Down Expand Up @@ -861,6 +865,10 @@ class Engine extends Disposable with EventsEmittable<EngineEvent> {
reason: event.reason.toSDKType());
await cleanUp();
}
})
..on<SignalResumedEvent>((event) async {
logger.fine('[$objectId] Signal resumed');
await resumeConnection.call(null);
});
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/core/room.dart
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
);
}

Future<void> _handlePostReconnect(bool isFullReconnect) async {
if (isFullReconnect) {
Future<void> _handlePostReconnect(bool rePublishAllTracks) async {
if (rePublishAllTracks) {
// re-publish all tracks
await localParticipant?.rePublishAllTracks();
}
Expand Down
2 changes: 2 additions & 0 deletions lib/src/core/signal_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,15 @@ extension SignalClientRequests on SignalClient {
@internal
void sendSyncState({
required lk_rtc.SessionDescription? answer,
required lk_rtc.SessionDescription? offer,
required lk_rtc.UpdateSubscription subscription,
required Iterable<lk_rtc.TrackPublishedResponse>? publishTracks,
required Iterable<lk_rtc.DataChannelInfo>? dataChannelInfo,
}) =>
_sendRequest(lk_rtc.SignalRequest(
syncState: lk_rtc.SyncState(
answer: answer,
offer: offer,
subscription: subscription,
publishTracks: publishTracks,
dataChannels: dataChannelInfo,
Expand Down
1 change: 0 additions & 1 deletion lib/src/core/transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ class Transport extends Disposable {

try {
final result = await pc.getRemoteDescription();
logger.fine('pc.getRemoteDescription $result');
return result;
} catch (_) {
logger.warning('pc.getRemoteDescription failed with error: $_');
Expand Down

0 comments on commit 7e83ecc

Please sign in to comment.