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,6 +1201,7 @@ class CallSession {
} }
Future<void> cleanUp() async { Future<void> cleanUp() async {
try {
for (final stream in streams) { for (final stream in streams) {
await stream.dispose(); await stream.dispose();
} }
@ -1209,6 +1210,9 @@ class CallSession {
await pc!.close(); await pc!.close();
await pc!.dispose(); await pc!.dispose();
} }
} catch (e) {
Logs().e('cleaning up streams failed', e);
}
} }
Future<void> _updateMuteStatus() async { Future<void> _updateMuteStatus() async {

View File

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