mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Update tgcalls, request required video channels.
This commit is contained in:
parent
1471e9b8e2
commit
e39ffbc83c
5 changed files with 116 additions and 105 deletions
|
@ -538,6 +538,7 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
|
||||||
using Update = Data::GroupCall::ParticipantUpdate;
|
using Update = Data::GroupCall::ParticipantUpdate;
|
||||||
real->participantUpdated(
|
real->participantUpdated(
|
||||||
) | rpl::start_with_next([=](const Update &data) {
|
) | rpl::start_with_next([=](const Update &data) {
|
||||||
|
auto changed = false;
|
||||||
auto newLarge = _videoEndpointLarge.current();
|
auto newLarge = _videoEndpointLarge.current();
|
||||||
auto updateCameraNotStreams = std::string();
|
auto updateCameraNotStreams = std::string();
|
||||||
auto updateScreenNotStreams = std::string();
|
auto updateScreenNotStreams = std::string();
|
||||||
|
@ -555,6 +556,8 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
|
||||||
}
|
}
|
||||||
if (_videoEndpointLarge.current() != newLarge) {
|
if (_videoEndpointLarge.current() != newLarge) {
|
||||||
setVideoEndpointLarge(newLarge);
|
setVideoEndpointLarge(newLarge);
|
||||||
|
} else if (changed) {
|
||||||
|
updateRequestedVideoChannelsDelayed();
|
||||||
}
|
}
|
||||||
if (!updateCameraNotStreams.empty()) {
|
if (!updateCameraNotStreams.empty()) {
|
||||||
_streamsVideoUpdated.fire({ updateCameraNotStreams, false });
|
_streamsVideoUpdated.fire({ updateCameraNotStreams, false });
|
||||||
|
@ -575,13 +578,13 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
|
||||||
if (!nowCameraEndpoint.empty()
|
if (!nowCameraEndpoint.empty()
|
||||||
&& _activeVideoEndpoints.emplace(
|
&& _activeVideoEndpoints.emplace(
|
||||||
nowCameraEndpoint,
|
nowCameraEndpoint,
|
||||||
EndpointType::Camera).second
|
EndpointType::Camera).second) {
|
||||||
&& _incomingVideoEndpoints.contains(nowCameraEndpoint)) {
|
changed = true;
|
||||||
_streamsVideoUpdated.fire({ nowCameraEndpoint, true });
|
_streamsVideoUpdated.fire({ nowCameraEndpoint, true });
|
||||||
}
|
}
|
||||||
if (!wasCameraEndpoint.empty()
|
if (!wasCameraEndpoint.empty()
|
||||||
&& _activeVideoEndpoints.remove(wasCameraEndpoint)
|
&& _activeVideoEndpoints.remove(wasCameraEndpoint)) {
|
||||||
&& _incomingVideoEndpoints.contains(wasCameraEndpoint)) {
|
changed = true;
|
||||||
updateCameraNotStreams = wasCameraEndpoint;
|
updateCameraNotStreams = wasCameraEndpoint;
|
||||||
if (newLarge.endpoint == wasCameraEndpoint) {
|
if (newLarge.endpoint == wasCameraEndpoint) {
|
||||||
newLarge = VideoEndpoint();
|
newLarge = VideoEndpoint();
|
||||||
|
@ -599,13 +602,13 @@ void GroupCall::subscribeToReal(not_null<Data::GroupCall*> real) {
|
||||||
if (!nowScreenEndpoint.empty()
|
if (!nowScreenEndpoint.empty()
|
||||||
&& _activeVideoEndpoints.emplace(
|
&& _activeVideoEndpoints.emplace(
|
||||||
nowScreenEndpoint,
|
nowScreenEndpoint,
|
||||||
EndpointType::Screen).second
|
EndpointType::Screen).second) {
|
||||||
&& _incomingVideoEndpoints.contains(nowScreenEndpoint)) {
|
changed = true;
|
||||||
_streamsVideoUpdated.fire({ nowScreenEndpoint, true });
|
_streamsVideoUpdated.fire({ nowScreenEndpoint, true });
|
||||||
}
|
}
|
||||||
if (!wasScreenEndpoint.empty()
|
if (!wasScreenEndpoint.empty()
|
||||||
&& _activeVideoEndpoints.remove(wasScreenEndpoint)
|
&& _activeVideoEndpoints.remove(wasScreenEndpoint)) {
|
||||||
&& _incomingVideoEndpoints.contains(wasScreenEndpoint)) {
|
changed = true;
|
||||||
updateScreenNotStreams = wasScreenEndpoint;
|
updateScreenNotStreams = wasScreenEndpoint;
|
||||||
if (newLarge.endpoint == wasScreenEndpoint) {
|
if (newLarge.endpoint == wasScreenEndpoint) {
|
||||||
newLarge = VideoEndpoint();
|
newLarge = VideoEndpoint();
|
||||||
|
@ -872,9 +875,8 @@ void GroupCall::setMyEndpointType(
|
||||||
if (endpoint.empty()) {
|
if (endpoint.empty()) {
|
||||||
return;
|
return;
|
||||||
} else if (type == EndpointType::None) {
|
} else if (type == EndpointType::None) {
|
||||||
const auto was1 = _incomingVideoEndpoints.remove(endpoint);
|
const auto was = _activeVideoEndpoints.remove(endpoint);
|
||||||
const auto was2 = _activeVideoEndpoints.remove(endpoint);
|
if (was) {
|
||||||
if (was1 && was2) {
|
|
||||||
auto newLarge = _videoEndpointLarge.current();
|
auto newLarge = _videoEndpointLarge.current();
|
||||||
if (newLarge.endpoint == endpoint) {
|
if (newLarge.endpoint == endpoint) {
|
||||||
_videoEndpointPinned = false;
|
_videoEndpointPinned = false;
|
||||||
|
@ -883,11 +885,10 @@ void GroupCall::setMyEndpointType(
|
||||||
_streamsVideoUpdated.fire({ endpoint, false });
|
_streamsVideoUpdated.fire({ endpoint, false });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const auto now1 = _incomingVideoEndpoints.emplace(endpoint).second;
|
const auto now = _activeVideoEndpoints.emplace(
|
||||||
const auto now2 = _activeVideoEndpoints.emplace(
|
|
||||||
endpoint,
|
endpoint,
|
||||||
type).second;
|
type).second;
|
||||||
if (now1 || now2) {
|
if (now) {
|
||||||
_streamsVideoUpdated.fire({ endpoint, true });
|
_streamsVideoUpdated.fire({ endpoint, true });
|
||||||
}
|
}
|
||||||
const auto nowLarge = activeVideoEndpointType(
|
const auto nowLarge = activeVideoEndpointType(
|
||||||
|
@ -913,9 +914,6 @@ void GroupCall::setScreenEndpoint(std::string endpoint) {
|
||||||
if (_screenEndpoint.empty()) {
|
if (_screenEndpoint.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_instance) {
|
|
||||||
_instance->setIgnoreVideoEndpointIds({ _screenEndpoint });
|
|
||||||
}
|
|
||||||
if (isSharingScreen()) {
|
if (isSharingScreen()) {
|
||||||
setMyEndpointType(_screenEndpoint, EndpointType::Screen);
|
setMyEndpointType(_screenEndpoint, EndpointType::Screen);
|
||||||
}
|
}
|
||||||
|
@ -1014,13 +1012,19 @@ void GroupCall::rejoin(not_null<PeerData*> as) {
|
||||||
|
|
||||||
const auto json = QByteArray::fromStdString(payload.json);
|
const auto json = QByteArray::fromStdString(payload.json);
|
||||||
const auto wasMuteState = muted();
|
const auto wasMuteState = muted();
|
||||||
|
const auto wasVideoMuted = !isSharingCamera();
|
||||||
using Flag = MTPphone_JoinGroupCall::Flag;
|
using Flag = MTPphone_JoinGroupCall::Flag;
|
||||||
|
const auto flags = (wasMuteState != MuteState::Active
|
||||||
|
? Flag::f_muted
|
||||||
|
: Flag(0))
|
||||||
|
| (_joinHash.isEmpty()
|
||||||
|
? Flag(0)
|
||||||
|
: Flag::f_invite_hash)
|
||||||
|
| (wasVideoMuted
|
||||||
|
? Flag::f_video_muted
|
||||||
|
: Flag(0));
|
||||||
_api.request(MTPphone_JoinGroupCall(
|
_api.request(MTPphone_JoinGroupCall(
|
||||||
MTP_flags((wasMuteState != MuteState::Active
|
MTP_flags(flags),
|
||||||
? Flag::f_muted
|
|
||||||
: Flag(0)) | (_joinHash.isEmpty()
|
|
||||||
? Flag(0)
|
|
||||||
: Flag::f_invite_hash)),
|
|
||||||
inputCall(),
|
inputCall(),
|
||||||
_joinAs->input,
|
_joinAs->input,
|
||||||
MTP_string(_joinHash),
|
MTP_string(_joinHash),
|
||||||
|
@ -1037,7 +1041,9 @@ void GroupCall::rejoin(not_null<PeerData*> as) {
|
||||||
_peer->session().api().applyUpdates(updates);
|
_peer->session().api().applyUpdates(updates);
|
||||||
applyQueuedSelfUpdates();
|
applyQueuedSelfUpdates();
|
||||||
checkFirstTimeJoined();
|
checkFirstTimeJoined();
|
||||||
sendSelfUpdate(SendUpdateType::VideoMuted);
|
if (wasVideoMuted == isSharingCamera()) {
|
||||||
|
sendSelfUpdate(SendUpdateType::VideoMuted);
|
||||||
|
}
|
||||||
if (_screenSsrc && isSharingScreen()) {
|
if (_screenSsrc && isSharingScreen()) {
|
||||||
LOG(("Call Info: Screen rejoin after rejoin()."));
|
LOG(("Call Info: Screen rejoin after rejoin()."));
|
||||||
rejoinPresentation();
|
rejoinPresentation();
|
||||||
|
@ -1452,8 +1458,9 @@ void GroupCall::handlePossibleCreateOrJoinResponse(
|
||||||
const auto json = data.vdata().v;
|
const auto json = data.vdata().v;
|
||||||
setCameraEndpoint(ParseVideoEndpoint(json));
|
setCameraEndpoint(ParseVideoEndpoint(json));
|
||||||
_instance->setJoinResponsePayload(json.toStdString());
|
_instance->setJoinResponsePayload(json.toStdString());
|
||||||
|
updateRequestedVideoChannels();
|
||||||
|
checkMediaChannelDescriptions();
|
||||||
});
|
});
|
||||||
checkMediaChannelDescriptions();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1800,12 +1807,6 @@ void GroupCall::ensureControllerCreated() {
|
||||||
.createAudioDeviceModule = Webrtc::AudioDeviceModuleCreator(
|
.createAudioDeviceModule = Webrtc::AudioDeviceModuleCreator(
|
||||||
settings.callAudioBackend()),
|
settings.callAudioBackend()),
|
||||||
.videoCapture = _cameraCapture,
|
.videoCapture = _cameraCapture,
|
||||||
.incomingVideoSourcesUpdated = [=](
|
|
||||||
std::vector<std::string> endpointIds) {
|
|
||||||
crl::on_main(weak, [=, endpoints = std::move(endpointIds)] {
|
|
||||||
setIncomingVideoEndpoints(endpoints);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
.requestBroadcastPart = [=, call = base::make_weak(this)](
|
.requestBroadcastPart = [=, call = base::make_weak(this)](
|
||||||
int64_t time,
|
int64_t time,
|
||||||
int64_t period,
|
int64_t period,
|
||||||
|
@ -1854,9 +1855,10 @@ void GroupCall::ensureControllerCreated() {
|
||||||
_instance = std::make_unique<tgcalls::GroupInstanceCustomImpl>(
|
_instance = std::make_unique<tgcalls::GroupInstanceCustomImpl>(
|
||||||
std::move(descriptor));
|
std::move(descriptor));
|
||||||
|
|
||||||
_videoEndpointLarge.changes(
|
_videoEndpointLarge.value(
|
||||||
) | rpl::start_with_next([=](const VideoEndpoint &endpoint) {
|
) | rpl::start_with_next([=](const VideoEndpoint &endpoint) {
|
||||||
_instance->setFullSizeVideoEndpointId(endpoint.endpoint);
|
updateRequestedVideoChannels();
|
||||||
|
|
||||||
_videoLargeTrack = LargeTrack();
|
_videoLargeTrack = LargeTrack();
|
||||||
_videoLargeTrackWrap = nullptr;
|
_videoLargeTrackWrap = nullptr;
|
||||||
if (!endpoint) {
|
if (!endpoint) {
|
||||||
|
@ -1873,10 +1875,6 @@ void GroupCall::ensureControllerCreated() {
|
||||||
|
|
||||||
updateInstanceMuteState();
|
updateInstanceMuteState();
|
||||||
updateInstanceVolumes();
|
updateInstanceVolumes();
|
||||||
|
|
||||||
if (!_screenEndpoint.empty()) {
|
|
||||||
_instance->setIgnoreVideoEndpointIds({ _screenEndpoint });
|
|
||||||
}
|
|
||||||
//raw->setAudioOutputDuckingEnabled(settings.callAudioDuckingEnabled());
|
//raw->setAudioOutputDuckingEnabled(settings.callAudioDuckingEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2071,43 +2069,52 @@ void GroupCall::mediaChannelDescriptionsCancel(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupCall::setIncomingVideoEndpoints(
|
void GroupCall::updateRequestedVideoChannels() {
|
||||||
const std::vector<std::string> &endpoints) {
|
_requestedVideoChannelsUpdateScheduled = false;
|
||||||
auto newLarge = _videoEndpointLarge.current();
|
const auto real = lookupReal();
|
||||||
auto newLargeFound = false;
|
if (!real || !_instance) {
|
||||||
auto removed = _incomingVideoEndpoints;
|
return;
|
||||||
const auto feedOne = [&](const std::string &endpoint) {
|
|
||||||
if (endpoint.empty()) {
|
|
||||||
return;
|
|
||||||
} else if (endpoint == newLarge.endpoint) {
|
|
||||||
newLargeFound = true;
|
|
||||||
}
|
|
||||||
if (!removed.remove(endpoint)) {
|
|
||||||
_incomingVideoEndpoints.emplace(endpoint);
|
|
||||||
if (_activeVideoEndpoints.contains(endpoint)) {
|
|
||||||
_streamsVideoUpdated.fire({ endpoint, true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
for (const auto &endpoint : endpoints) {
|
|
||||||
if (endpoint != _cameraEndpoint && endpoint != _screenEndpoint) {
|
|
||||||
feedOne(endpoint);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
feedOne(cameraSharingEndpoint());
|
auto channels = std::vector<tgcalls::VideoChannelDescription>();
|
||||||
feedOne(screenSharingEndpoint());
|
using Quality = tgcalls::VideoChannelDescription::Quality;
|
||||||
if (newLarge && !newLargeFound) {
|
channels.reserve(_activeVideoEndpoints.size());
|
||||||
_videoEndpointPinned = false;
|
const auto &camera = cameraSharingEndpoint();
|
||||||
newLarge = VideoEndpoint();
|
const auto &screen = screenSharingEndpoint();
|
||||||
}
|
const auto &large = _videoEndpointLarge.current().endpoint;
|
||||||
if (newLarge.empty()) {
|
for (const auto &[endpoint, endpointType] : _activeVideoEndpoints) {
|
||||||
setVideoEndpointLarge(chooseLargeVideoEndpoint());
|
if (endpoint == camera || endpoint == screen) {
|
||||||
}
|
continue;
|
||||||
for (const auto &endpoint : removed) {
|
|
||||||
if (_activeVideoEndpoints.contains(endpoint)) {
|
|
||||||
_streamsVideoUpdated.fire({ endpoint, false });
|
|
||||||
}
|
}
|
||||||
|
const auto participant = real->participantByEndpoint(endpoint);
|
||||||
|
const auto params = (participant && participant->ssrc)
|
||||||
|
? participant->videoParams.get()
|
||||||
|
: nullptr;
|
||||||
|
if (!params) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
channels.push_back({
|
||||||
|
.audioSsrc = participant->ssrc,
|
||||||
|
.videoInformation = (params->camera.endpoint == endpoint
|
||||||
|
? params->camera.json.toStdString()
|
||||||
|
: params->screen.json.toStdString()),
|
||||||
|
.quality = (endpoint == large
|
||||||
|
? Quality::Full
|
||||||
|
: Quality::Thumbnail),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
_instance->setRequestedVideoChannels(std::move(channels));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GroupCall::updateRequestedVideoChannelsDelayed() {
|
||||||
|
if (_requestedVideoChannelsUpdateScheduled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_requestedVideoChannelsUpdateScheduled = true;
|
||||||
|
crl::on_main(this, [=] {
|
||||||
|
if (_requestedVideoChannelsUpdateScheduled) {
|
||||||
|
updateRequestedVideoChannels();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupCall::fillActiveVideoEndpoints() {
|
void GroupCall::fillActiveVideoEndpoints() {
|
||||||
|
@ -2128,9 +2135,7 @@ void GroupCall::fillActiveVideoEndpoints() {
|
||||||
}
|
}
|
||||||
if (!removed.remove(endpoint)) {
|
if (!removed.remove(endpoint)) {
|
||||||
_activeVideoEndpoints.emplace(endpoint, type);
|
_activeVideoEndpoints.emplace(endpoint, type);
|
||||||
if (_incomingVideoEndpoints.contains(endpoint)) {
|
_streamsVideoUpdated.fire({ endpoint, true });
|
||||||
_streamsVideoUpdated.fire({ endpoint, true });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
for (const auto &participant : participants) {
|
for (const auto &participant : participants) {
|
||||||
|
@ -2157,6 +2162,7 @@ void GroupCall::fillActiveVideoEndpoints() {
|
||||||
_streamsVideoUpdated.fire({ endpoint, false });
|
_streamsVideoUpdated.fire({ endpoint, false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateRequestedVideoChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupCall::EndpointType GroupCall::activeVideoEndpointType(
|
GroupCall::EndpointType GroupCall::activeVideoEndpointType(
|
||||||
|
@ -2182,10 +2188,8 @@ VideoEndpoint GroupCall::chooseLargeVideoEndpoint() const {
|
||||||
const auto &myCameraEndpoint = cameraSharingEndpoint();
|
const auto &myCameraEndpoint = cameraSharingEndpoint();
|
||||||
const auto &myScreenEndpoint = screenSharingEndpoint();
|
const auto &myScreenEndpoint = screenSharingEndpoint();
|
||||||
const auto &participants = real->participants();
|
const auto &participants = real->participants();
|
||||||
for (const auto &endpoint : _incomingVideoEndpoints) {
|
for (const auto &[endpoint, endpointType] : _activeVideoEndpoints) {
|
||||||
if (!_activeVideoEndpoints.contains(endpoint)
|
if (endpoint == _cameraEndpoint || endpoint == _screenEndpoint) {
|
||||||
|| endpoint == _cameraEndpoint
|
|
||||||
|| endpoint == _screenEndpoint) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (const auto participant = real->participantByEndpoint(endpoint)) {
|
if (const auto participant = real->participantByEndpoint(endpoint)) {
|
||||||
|
|
|
@ -280,7 +280,6 @@ public:
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool streamsVideo(const std::string &endpoint) const {
|
[[nodiscard]] bool streamsVideo(const std::string &endpoint) const {
|
||||||
return !endpoint.empty()
|
return !endpoint.empty()
|
||||||
&& _incomingVideoEndpoints.contains(endpoint)
|
|
||||||
&& activeVideoEndpointType(endpoint) != EndpointType::None;
|
&& activeVideoEndpointType(endpoint) != EndpointType::None;
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool videoEndpointPinned() const {
|
[[nodiscard]] bool videoEndpointPinned() const {
|
||||||
|
@ -446,8 +445,8 @@ private:
|
||||||
void stopConnectingSound();
|
void stopConnectingSound();
|
||||||
void playConnectingSoundOnce();
|
void playConnectingSoundOnce();
|
||||||
|
|
||||||
void setIncomingVideoEndpoints(
|
void updateRequestedVideoChannels();
|
||||||
const std::vector<std::string> &endpoints);
|
void updateRequestedVideoChannelsDelayed();
|
||||||
void fillActiveVideoEndpoints();
|
void fillActiveVideoEndpoints();
|
||||||
[[nodiscard]] VideoEndpoint chooseLargeVideoEndpoint() const;
|
[[nodiscard]] VideoEndpoint chooseLargeVideoEndpoint() const;
|
||||||
[[nodiscard]] EndpointType activeVideoEndpointType(
|
[[nodiscard]] EndpointType activeVideoEndpointType(
|
||||||
|
@ -484,6 +483,7 @@ private:
|
||||||
rpl::variable<State> _state = State::Creating;
|
rpl::variable<State> _state = State::Creating;
|
||||||
base::flat_set<uint32> _unresolvedSsrcs;
|
base::flat_set<uint32> _unresolvedSsrcs;
|
||||||
bool _recordingStoppedByMe = false;
|
bool _recordingStoppedByMe = false;
|
||||||
|
bool _requestedVideoChannelsUpdateScheduled = false;
|
||||||
|
|
||||||
MTP::DcId _broadcastDcId = 0;
|
MTP::DcId _broadcastDcId = 0;
|
||||||
base::flat_map<not_null<LoadPartTask*>, LoadingPart> _broadcastParts;
|
base::flat_map<not_null<LoadPartTask*>, LoadingPart> _broadcastParts;
|
||||||
|
@ -537,7 +537,6 @@ private:
|
||||||
|
|
||||||
rpl::event_stream<LevelUpdate> _levelUpdates;
|
rpl::event_stream<LevelUpdate> _levelUpdates;
|
||||||
rpl::event_stream<StreamsVideoUpdate> _streamsVideoUpdated;
|
rpl::event_stream<StreamsVideoUpdate> _streamsVideoUpdated;
|
||||||
base::flat_set<std::string> _incomingVideoEndpoints;
|
|
||||||
base::flat_map<std::string, EndpointType> _activeVideoEndpoints;
|
base::flat_map<std::string, EndpointType> _activeVideoEndpoints;
|
||||||
rpl::variable<VideoEndpoint> _videoEndpointLarge;
|
rpl::variable<VideoEndpoint> _videoEndpointLarge;
|
||||||
rpl::variable<bool> _videoEndpointPinned;
|
rpl::variable<bool> _videoEndpointPinned;
|
||||||
|
|
|
@ -221,8 +221,6 @@ Members::Controller::Controller(
|
||||||
ImageRoundRadius::Large,
|
ImageRoundRadius::Large,
|
||||||
st::groupCallMembersBgOver)
|
st::groupCallMembersBgOver)
|
||||||
, _narrowRoundRect(ImageRoundRadius::Large, st::groupCallMembersBg) {
|
, _narrowRoundRect(ImageRoundRadius::Large, st::groupCallMembersBg) {
|
||||||
setupListChangeViewers();
|
|
||||||
|
|
||||||
style::PaletteChanged(
|
style::PaletteChanged(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
_inactiveCrossLine.invalidate();
|
_inactiveCrossLine.invalidate();
|
||||||
|
@ -304,12 +302,12 @@ void Members::Controller::setupListChangeViewers() {
|
||||||
subscribeToChanges(real);
|
subscribeToChanges(real);
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
|
|
||||||
_call->stateValue(
|
//_call->stateValue(
|
||||||
) | rpl::start_with_next([=] {
|
//) | rpl::start_with_next([=] {
|
||||||
if (const auto real = _call->lookupReal()) {
|
// if (const auto real = _call->lookupReal()) {
|
||||||
//updateRow(channel->session().user());
|
// updateRow(channel->session().user());
|
||||||
}
|
// }
|
||||||
}, _lifetime);
|
//}, _lifetime);
|
||||||
|
|
||||||
_call->levelUpdates(
|
_call->levelUpdates(
|
||||||
) | rpl::start_with_next([=](const LevelUpdate &update) {
|
) | rpl::start_with_next([=](const LevelUpdate &update) {
|
||||||
|
@ -769,6 +767,8 @@ void Members::Controller::prepare() {
|
||||||
loadMoreRows();
|
loadMoreRows();
|
||||||
appendInvitedUsers();
|
appendInvitedUsers();
|
||||||
_prepared = true;
|
_prepared = true;
|
||||||
|
|
||||||
|
setupListChangeViewers();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Members::Controller::isMe(not_null<PeerData*> participantPeer) const {
|
bool Members::Controller::isMe(not_null<PeerData*> participantPeer) const {
|
||||||
|
@ -1435,6 +1435,14 @@ std::unique_ptr<Row> Members::Controller::createRow(
|
||||||
const Data::GroupCallParticipant &participant) {
|
const Data::GroupCallParticipant &participant) {
|
||||||
auto result = std::make_unique<Row>(this, participant.peer);
|
auto result = std::make_unique<Row>(this, participant.peer);
|
||||||
updateRow(result.get(), &participant);
|
updateRow(result.get(), &participant);
|
||||||
|
|
||||||
|
const auto &camera = computeCameraEndpoint(&participant);
|
||||||
|
const auto &screen = computeScreenEndpoint(&participant);
|
||||||
|
if (!screen.empty() && _largeEndpoint != screen) {
|
||||||
|
setRowVideoEndpoint(result.get(), screen);
|
||||||
|
} else if (!camera.empty() && _largeEndpoint != camera) {
|
||||||
|
setRowVideoEndpoint(result.get(), camera);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1457,25 +1465,13 @@ Members::Members(
|
||||||
, _listController(std::make_unique<Controller>(call, parent))
|
, _listController(std::make_unique<Controller>(call, parent))
|
||||||
, _layout(_scroll->setOwnedWidget(
|
, _layout(_scroll->setOwnedWidget(
|
||||||
object_ptr<Ui::VerticalLayout>(_scroll.data())))
|
object_ptr<Ui::VerticalLayout>(_scroll.data())))
|
||||||
, _pinnedVideoWrap(_layout->add(object_ptr<Ui::RpWidget>(_layout.get())))
|
, _pinnedVideoWrap(_layout->add(object_ptr<Ui::RpWidget>(_layout.get()))) {
|
||||||
, _pinnedVideo(
|
|
||||||
std::make_unique<LargeVideo>(
|
|
||||||
_pinnedVideoWrap.get(),
|
|
||||||
st::groupCallLargeVideoNarrow,
|
|
||||||
true,
|
|
||||||
_call->videoLargeTrackValue(
|
|
||||||
) | rpl::map([=](GroupCall::LargeTrack track) {
|
|
||||||
const auto row = track ? lookupRow(track.peer) : nullptr;
|
|
||||||
Assert(!track || row != nullptr);
|
|
||||||
return LargeVideoTrack{ row ? track.track : nullptr, row };
|
|
||||||
}),
|
|
||||||
_call->videoEndpointPinnedValue())) {
|
|
||||||
setupAddMember(call);
|
setupAddMember(call);
|
||||||
setupList();
|
setupList();
|
||||||
setupPinnedVideo();
|
|
||||||
setContent(_list);
|
setContent(_list);
|
||||||
setupFakeRoundCorners();
|
setupFakeRoundCorners();
|
||||||
_listController->setDelegate(static_cast<PeerListDelegate*>(this));
|
_listController->setDelegate(static_cast<PeerListDelegate*>(this));
|
||||||
|
setupPinnedVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
Members::~Members() = default;
|
Members::~Members() = default;
|
||||||
|
@ -1652,6 +1648,18 @@ void Members::setupList() {
|
||||||
void Members::setupPinnedVideo() {
|
void Members::setupPinnedVideo() {
|
||||||
using namespace rpl::mappers;
|
using namespace rpl::mappers;
|
||||||
|
|
||||||
|
_pinnedVideo = std::make_unique<LargeVideo>(
|
||||||
|
_pinnedVideoWrap.get(),
|
||||||
|
st::groupCallLargeVideoNarrow,
|
||||||
|
true,
|
||||||
|
_call->videoLargeTrackValue(
|
||||||
|
) | rpl::map([=](GroupCall::LargeTrack track) {
|
||||||
|
const auto row = track ? lookupRow(track.peer) : nullptr;
|
||||||
|
Assert(!track || row != nullptr);
|
||||||
|
return LargeVideoTrack{ row ? track.track : nullptr, row };
|
||||||
|
}),
|
||||||
|
_call->videoEndpointPinnedValue());
|
||||||
|
|
||||||
_pinnedVideo->pinToggled(
|
_pinnedVideo->pinToggled(
|
||||||
) | rpl::start_with_next([=](bool pinned) {
|
) | rpl::start_with_next([=](bool pinned) {
|
||||||
if (!pinned) {
|
if (!pinned) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ private:
|
||||||
std::unique_ptr<Controller> _listController;
|
std::unique_ptr<Controller> _listController;
|
||||||
not_null<Ui::VerticalLayout*> _layout;
|
not_null<Ui::VerticalLayout*> _layout;
|
||||||
const not_null<Ui::RpWidget*> _pinnedVideoWrap;
|
const not_null<Ui::RpWidget*> _pinnedVideoWrap;
|
||||||
const std::unique_ptr<LargeVideo> _pinnedVideo;
|
std::unique_ptr<LargeVideo> _pinnedVideo;
|
||||||
rpl::variable<Ui::RpWidget*> _addMemberButton = nullptr;
|
rpl::variable<Ui::RpWidget*> _addMemberButton = nullptr;
|
||||||
ListWidget *_list = nullptr;
|
ListWidget *_list = nullptr;
|
||||||
rpl::event_stream<> _addMemberRequests;
|
rpl::event_stream<> _addMemberRequests;
|
||||||
|
|
2
Telegram/ThirdParty/tgcalls
vendored
2
Telegram/ThirdParty/tgcalls
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 9a2b95507fe19de2e969517453ae0874fbe1ae62
|
Subproject commit a362d24ee97ed1a5c2e3a82656e897adf3354613
|
Loading…
Add table
Reference in a new issue