From ce256161f1886c6dfc5c5c507c2d3aa7a30538f0 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 13 Sep 2021 17:39:17 +0300 Subject: [PATCH] Couple of crash fixes. --- .../calls/group/calls_group_viewport_tile.cpp | 13 +++++++++---- .../calls/group/calls_group_viewport_tile.h | 2 +- Telegram/lib_ui | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.cpp b/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.cpp index 5a438c14f4..ac8f9b4b1a 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.cpp @@ -35,6 +35,14 @@ Viewport::VideoTile::VideoTile( Expects(track.track != nullptr); Expects(track.row != nullptr); + using namespace rpl::mappers; + _track.track->stateValue( + ) | rpl::filter( + _1 == Webrtc::VideoState::Paused + ) | rpl::take(1) | rpl::start_with_next([=] { + _wasPaused = true; + }, _lifetime); + setup(std::move(pinned)); } @@ -68,11 +76,8 @@ QSize Viewport::VideoTile::PausedVideoSize() { QSize Viewport::VideoTile::trackOrUserpicSize() const { if (const auto size = trackSize(); !size.isEmpty()) { return size; - } else if (_userpicSize.isEmpty() - && _track.track->state() == Webrtc::VideoState::Paused) { - _userpicSize = PausedVideoSize(); } - return _userpicSize; + return _wasPaused ? PausedVideoSize() : QSize(); } bool Viewport::VideoTile::screencast() const { diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.h b/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.h index 3a2efa2671..1f2559afca 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.h +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.h @@ -110,12 +110,12 @@ private: QRect _geometry; TileAnimation _animation; rpl::variable _trackSize; - mutable QSize _userpicSize; QRect _pinOuter; QRect _pinInner; QRect _backOuter; QRect _backInner; Ui::Animations::Simple _topControlsShownAnimation; + bool _wasPaused = false; bool _topControlsShown = false; bool _pinned = false; bool _hidden = true; diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 8d634fc946..8589a8d850 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 8d634fc9460569b24186858f9eb65c3e3be97271 +Subproject commit 8589a8d8501701e1b93f9752abdaf1740e6d0517