@@ -377,25 +377,23 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult) result
377
377
NSString * peerConnectionId = argsMap[@" peerConnectionId" ];
378
378
379
379
RTCPeerConnection *peerConnection = self.peerConnections [peerConnectionId];
380
- if (!peerConnection) {
381
- return ;
382
- }
383
- [peerConnection close ];
384
- [self .peerConnections removeObjectForKey: peerConnectionId];
385
-
386
- // Clean up peerConnection's streams and tracks
387
- [peerConnection.remoteStreams removeAllObjects ];
388
- [peerConnection.remoteTracks removeAllObjects ];
389
-
390
- // Clean up peerConnection's dataChannels.
391
- NSMutableDictionary <NSNumber *, RTCDataChannel *> *dataChannels
392
- = peerConnection.dataChannels ;
393
- for (NSNumber *dataChannelId in dataChannels) {
394
- dataChannels[dataChannelId].delegate = nil ;
395
- // There is no need to close the RTCDataChannel because it is owned by the
396
- // RTCPeerConnection and the latter will close the former.
380
+ if (peerConnection) {
381
+ [peerConnection close ];
382
+ [self .peerConnections removeObjectForKey: peerConnectionId];
383
+
384
+ // Clean up peerConnection's streams and tracks
385
+ [peerConnection.remoteStreams removeAllObjects ];
386
+ [peerConnection.remoteTracks removeAllObjects ];
387
+
388
+ // Clean up peerConnection's dataChannels.
389
+ NSMutableDictionary <NSNumber *, RTCDataChannel *> *dataChannels = peerConnection.dataChannels ;
390
+ for (NSNumber *dataChannelId in dataChannels) {
391
+ dataChannels[dataChannelId].delegate = nil ;
392
+ // There is no need to close the RTCDataChannel because it is owned by the
393
+ // RTCPeerConnection and the latter will close the former.
394
+ }
395
+ [dataChannels removeAllObjects ];
397
396
}
398
- [dataChannels removeAllObjects ];
399
397
result (nil );
400
398
} else if ([@" createVideoRenderer" isEqualToString: call.method]){
401
399
NSDictionary * argsMap = call.arguments ;
0 commit comments