Check unmuted video limit in group call.

This commit is contained in:
John Preston 2021-07-12 15:37:34 +03:00
parent 801c8b6220
commit 402729dc99
3 changed files with 10 additions and 25 deletions

View file

@ -677,20 +677,6 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
setScheduledDate(date);
}, _lifetime);
// If we joined before you could start video and then you can,
// you have to rejoin so that the server knows your video params.
//real->canStartVideoValue( // ignore can_start_video after call start.
//) | rpl::combine_previous(
//) | rpl::start_with_next([=](bool could, bool can) {
// if (could || !can) {
// return;
// } if (_joinState.action == JoinAction::None) {
// rejoin();
// } else {
// _joinState.nextActionPending = true;
// }
//}, _lifetime);
// Postpone creating video tracks, so that we know if Panel
// supports OpenGL and we don't need ARGB32 frames at all.
Ui::PostponeCall(this, [=] {
@ -1965,9 +1951,10 @@ bool GroupCall::emitShareCameraError() {
emitShareCameraError(error);
return true;
};
/*if (const auto real = lookupReal(); real && !real->canStartVideo()) {
if (const auto real = lookupReal()
; real && _activeVideoTracks.size() >= real->unmutedVideoLimit()) {
return emitError(Error::DisabledNoCamera);
} else */if (!videoIsWorking()) {
} else if (!videoIsWorking()) {
return emitError(Error::DisabledNoCamera);
} else if (mutedByAdmin()) {
return emitError(Error::MutedNoCamera);
@ -1991,9 +1978,10 @@ bool GroupCall::emitShareScreenError() {
emitShareScreenError(error);
return true;
};
/*if (const auto real = lookupReal(); real && !real->canStartVideo()) {
if (const auto real = lookupReal()
; real && _activeVideoTracks.size() >= real->unmutedVideoLimit()) {
return emitError(Error::DisabledNoScreen);
} else */if (!videoIsWorking()) {
} else if (!videoIsWorking()) {
return emitError(Error::DisabledNoScreen);
} else if (mutedByAdmin()) {
return emitError(Error::MutedNoScreen);

View file

@ -392,7 +392,7 @@ void GroupCall::applyCallFields(const MTPDgroupCall &data) {
_recordStartDate = data.vrecord_start_date().value_or_empty();
_scheduleDate = data.vschedule_date().value_or_empty();
_scheduleStartSubscribed = data.is_schedule_start_subscribed();
_canStartVideo = data.is_can_start_video();
_unmutedVideoLimit = data.vunmuted_video_limit().v;
_allParticipantsLoaded
= (_serverParticipantsCount == _participants.size());
}

View file

@ -95,11 +95,8 @@ public:
[[nodiscard]] rpl::producer<bool> scheduleStartSubscribedValue() const {
return _scheduleStartSubscribed.value();
}
[[nodiscard]] bool canStartVideo() const {
return _canStartVideo.current();
}
[[nodiscard]] rpl::producer<bool> canStartVideoValue() const {
return _canStartVideo.value();
[[nodiscard]] int unmutedVideoLimit() const {
return _unmutedVideoLimit.current();
}
void setPeer(not_null<PeerData*> peer);
@ -216,10 +213,10 @@ private:
QString _nextOffset;
int _serverParticipantsCount = 0;
rpl::variable<int> _fullCount = 0;
rpl::variable<int> _unmutedVideoLimit = 0;
rpl::variable<TimeId> _recordStartDate = 0;
rpl::variable<TimeId> _scheduleDate = 0;
rpl::variable<bool> _scheduleStartSubscribed = false;
rpl::variable<bool> _canStartVideo = false;
base::flat_map<uint32, LastSpokeTimes> _unknownSpokenSsrcs;
base::flat_map<PeerId, LastSpokeTimes> _unknownSpokenPeerIds;