Hide members in RTMP streams.

This commit is contained in:
John Preston 2022-02-28 13:52:49 +03:00
parent 39c10b9e1c
commit 25e29d3dd5
5 changed files with 35 additions and 8 deletions

View file

@ -582,6 +582,7 @@ GroupCall::GroupCall(
, _checkJoinedTimer([=] { checkJoined(); })
, _pushToTalkCancelTimer([=] { pushToTalkCancel(); })
, _connectingSoundTimer([=] { playConnectingSoundOnce(); })
, _listenersHidden(info.rtmp)
, _rtmp(info.rtmp)
, _mediaDevices(CreateMediaDevices()) {
_muted.value(
@ -693,7 +694,9 @@ bool GroupCall::screenSharingWithAudio() const {
bool GroupCall::mutedByAdmin() const {
const auto mute = muted();
return mute == MuteState::ForceMuted || mute == MuteState::RaisedHand;
return _rtmp
|| (mute == MuteState::ForceMuted)
|| (mute == MuteState::RaisedHand);
}
bool GroupCall::canManage() const {
@ -756,6 +759,8 @@ void GroupCall::setScheduledDate(TimeId date) {
}
void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
_listenersHidden = real->listenersHidden();
real->scheduleDateValue(
) | rpl::start_with_next([=](TimeId date) {
setScheduledDate(date);
@ -1001,6 +1006,10 @@ bool GroupCall::rtmp() const {
return _rtmp;
}
bool GroupCall::listenersHidden() const {
return _listenersHidden;
}
Data::GroupCall *GroupCall::lookupReal() const {
const auto real = _peer->groupCall();
return (real && real->id() == _id) ? real : nullptr;

View file

@ -232,6 +232,7 @@ public:
}
[[nodiscard]] bool scheduleStartSubscribed() const;
[[nodiscard]] bool rtmp() const;
[[nodiscard]] bool listenersHidden() const;
[[nodiscard]] Data::GroupCall *lookupReal() const;
[[nodiscard]] rpl::producer<not_null<Data::GroupCall*>> real() const;
@ -659,6 +660,7 @@ private:
base::Timer _pushToTalkCancelTimer;
base::Timer _connectingSoundTimer;
bool _hadJoinedState = false;
bool _listenersHidden = false;
bool _rtmp = false;
std::unique_ptr<Webrtc::MediaDevices> _mediaDevices;

View file

@ -1433,8 +1433,9 @@ bool Panel::updateMode() {
if (!_viewport) {
return false;
}
const auto wide = _call->hasVideoWithFrames()
&& (widget()->width() >= st::groupCallWideModeWidthMin);
const auto wide = _call->rtmp()
|| (_call->hasVideoWithFrames()
&& (widget()->width() >= st::groupCallWideModeWidthMin));
const auto mode = wide ? PanelMode::Wide : PanelMode::Default;
if (_mode.current() == mode) {
return false;
@ -1457,6 +1458,8 @@ bool Panel::updateMode() {
_subtitle.destroy();
} else if (!wide && !_subtitle) {
refreshTitle();
} else if (!_members) {
setupMembers();
}
_wideControlsShown = _showWideControls = true;
_wideControlsAnimation.stop();
@ -1934,7 +1937,7 @@ void Panel::updateButtonsGeometry() {
const auto hidden = (shown == 0.);
if (_viewport) {
_viewport->setControlsShown(shown);
_viewport->setControlsShown(_call->rtmp() ? 0. : shown);
}
const auto buttonsTop = widget()->height() - anim::interpolate(
@ -1950,8 +1953,9 @@ void Panel::updateButtonsGeometry() {
+ (_settings ->width() + skip)
+ _hangup->width();
const auto membersSkip = st::groupCallNarrowSkip;
const auto membersWidth = st::groupCallNarrowMembersWidth
+ 2 * membersSkip;
const auto membersWidth = _call->rtmp()
? membersSkip
: (st::groupCallNarrowMembersWidth + 2 * membersSkip);
auto left = membersSkip + (widget()->width()
- membersWidth
- membersSkip
@ -2046,6 +2050,7 @@ void Panel::updateMembersGeometry() {
if (!_members) {
return;
}
_members->setVisible(!_call->rtmp());
const auto desiredHeight = _members->desiredHeight();
if (mode() == PanelMode::Wide) {
const auto skip = st::groupCallNarrowSkip;
@ -2056,10 +2061,13 @@ void Panel::updateMembersGeometry() {
top,
membersWidth,
std::min(desiredHeight, widget()->height() - top - skip));
const auto viewportSkip = _call->rtmp()
? 0
: (skip + membersWidth);
_viewport->setGeometry({
skip,
top,
widget()->width() - membersWidth - 3 * skip,
widget()->width() - viewportSkip - 2 * skip,
widget()->height() - top - skip,
});
} else {

View file

@ -68,7 +68,8 @@ GroupCall::GroupCall(
, _reloadByQueuedUpdatesTimer([=] { reload(); })
, _speakingByActiveFinishTimer([=] { checkFinishSpeakingByActive(); })
, _scheduleDate(scheduleDate)
, _rtmp(rtmp) {
, _rtmp(rtmp)
, _listenersHidden(rtmp) {
}
GroupCall::~GroupCall() {
@ -89,6 +90,10 @@ bool GroupCall::rtmp() const {
return _rtmp;
}
bool GroupCall::listenersHidden() const {
return _listenersHidden;
}
not_null<PeerData*> GroupCall::peer() const {
return _peer;
}
@ -395,6 +400,7 @@ void GroupCall::applyCallFields(const MTPDgroupCall &data) {
_version = 1;
}
_rtmp = data.is_rtmp_stream();
_listenersHidden = data.is_listeners_hidden();
_joinMuted = data.is_join_muted();
_canChangeJoinMuted = data.is_can_change_join_muted();
_joinedToTop = !data.is_join_date_asc();

View file

@ -64,6 +64,7 @@ public:
[[nodiscard]] CallId id() const;
[[nodiscard]] bool loaded() const;
[[nodiscard]] bool rtmp() const;
[[nodiscard]] bool listenersHidden() const;
[[nodiscard]] not_null<PeerData*> peer() const;
[[nodiscard]] MTPInputGroupCall input() const;
[[nodiscard]] QString title() const {
@ -244,6 +245,7 @@ private:
bool _joinedToTop = false;
bool _applyingQueuedUpdates = false;
bool _rtmp = false;
bool _listenersHidden = false;
};