Don't reload the complete cell if a video stream is added

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2023-01-14 23:06:08 +01:00
Родитель 66ad8d88e3
Коммит fb879a791e
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -1418,12 +1418,20 @@ typedef NS_ENUM(NSInteger, CallState) {
if ([remotePeer.roomType isEqualToString:kRoomTypeVideo]) {
[self->_videoRenderersDict setObject:renderView forKey:remotePeer.peerId];
NSIndexPath *indexPath = [self indexPathForPeerId:remotePeer.peerId];
if (!indexPath) {
// This is a new peer, add it to the collection view
[self->_peersInCall addObject:remotePeer];
NSIndexPath *insertionIndexPath = [NSIndexPath indexPathForRow:self->_peersInCall.count - 1 inSection:0];
[self.collectionView insertItemsAtIndexPaths:@[insertionIndexPath]];
} else {
[self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
// This peer already exists in the collection view, so we can just update its cell
[self updatePeer:remotePeer block:^(CallParticipantViewCell *cell) {
[cell setVideoView:renderView];
[cell setVideoDisabled:!self->_isAudioOnly];
}];
}
} else if ([remotePeer.roomType isEqualToString:kRoomTypeScreen]) {
[self->_screenRenderersDict setObject:renderView forKey:remotePeer.peerId];