Fix crash in joining active video chat.

This commit is contained in:
John Preston 2021-05-14 20:25:45 +04:00
parent a730c88491
commit 64243d1437

View file

@ -1243,15 +1243,26 @@ void Panel::setupPinnedVideo() {
} }
_call->videoStreamActiveUpdates( _call->videoStreamActiveUpdates(
) | rpl::start_with_next([=](const VideoEndpoint &endpoint) { ) | rpl::start_with_next([=](const VideoEndpoint &endpoint) {
const auto &tracks = _call->activeVideoTracks(); if (_call->activeVideoTracks().contains(endpoint)) {
const auto i = tracks.find(endpoint); // Add async (=> the participant row is definitely in Members).
if (i != end(tracks)) { crl::on_main(_pinnedVideoWrap.get(), [=] {
_videoTiles.push_back(setupTile(endpoint, i->second)); const auto &tracks = _call->activeVideoTracks();
const auto i = tracks.find(endpoint);
if (i != end(tracks)) {
_videoTiles.push_back(setupTile(endpoint, i->second));
}
});
} else { } else {
_videoTiles.erase( // Remove sync.
ranges::remove(_videoTiles, endpoint, &VideoTile::endpoint), const auto eraseTill = end(_videoTiles);
end(_videoTiles)); const auto eraseFrom = ranges::remove(
refreshTilesGeometry(); _videoTiles,
endpoint,
&VideoTile::endpoint);
if (eraseFrom != eraseTill) {
_videoTiles.erase(eraseFrom, eraseTill);
refreshTilesGeometry();
}
} }
}, _pinnedVideoWrap->lifetime()); }, _pinnedVideoWrap->lifetime());