fix: update groupCalls state stream

refactor: add a try catch around disposing streams. Decoding streams is broken in flutter_webrtc atm
This commit is contained in:
td 2023-01-23 06:43:35 +05:30
parent e81fce1f1f
commit 5510049dec
No known key found for this signature in database
GPG Key ID: F6D9E9BF14C7D103
2 changed files with 13 additions and 8 deletions

View File

@ -1201,13 +1201,17 @@ class CallSession {
}
Future<void> cleanUp() async {
for (final stream in streams) {
await stream.dispose();
}
streams.clear();
if (pc != null) {
await pc!.close();
await pc!.dispose();
try {
for (final stream in streams) {
await stream.dispose();
}
streams.clear();
if (pc != null) {
await pc!.close();
await pc!.dispose();
}
} catch (e) {
Logs().e('cleaning up streams failed', e);
}
}

View File

@ -211,7 +211,7 @@ class GroupCall {
final CachedStreamController<GroupCall> onGroupCallFeedsChanged =
CachedStreamController();
final CachedStreamController<GroupCallState> onGroupCallState =
final CachedStreamController<String> onGroupCallState =
CachedStreamController();
final CachedStreamController<String> onGroupCallEvent =
@ -294,6 +294,7 @@ class GroupCall {
void setState(String newState) {
state = newState;
onGroupCallState.add(newState);
onGroupCallEvent.add(GroupCallEvent.GroupCallStateChanged);
}