Some minor changes and fixes

This commit is contained in:
WolverinDEV
2020-12-17 12:00:27 +01:00
parent 6605a440bd
commit 0cff59328f
9 changed files with 66 additions and 59 deletions
+19 -16
View File
@@ -550,14 +550,6 @@ void SpeakingClient::processLeave() {
server->music_manager_->cleanup_client_bots(this->getClientDatabaseId());
//ref_server = nullptr; Removed caused nullptr exceptions
}
{ //Delete own viewing clients
/*
* No need, are only weak references!
threads::MutexLock l(this->viewLock);
this->visibleClients.clear();
this->mutedClients.clear();
*/
}
}
void SpeakingClient::triggerVoiceEnd() {
@@ -798,22 +790,33 @@ command_result SpeakingClient::handleCommandBroadcastVideoJoin(Command &cmd) {
return ts::command_result{error::vs_critical, "failed to count client streams"};
}
if(!permission::v2::permission_granted(camera_streams + screen_streams, this->calculate_permission(permission::i_video_max_streams, this->getChannelId()), false)) {
return ts::command_result{permission::i_video_max_streams};
auto permission_max_streams = this->calculate_permission(permission::i_video_max_streams, this->getChannelId());
if(permission_max_streams.has_value) {
if(!permission::v2::permission_granted(camera_streams + screen_streams, permission_max_streams, false)) {
return ts::command_result{permission::i_video_max_streams};
}
}
switch(broadcast_type) {
case rtc::VideoBroadcastType::Camera:
if(!permission::v2::permission_granted(camera_streams, this->calculate_permission(permission::i_video_max_camera_streams, this->getChannelId()), false)) {
return ts::command_result{permission::i_video_max_camera_streams};
case rtc::VideoBroadcastType::Camera: {
const auto permission_max_camera_streams = this->calculate_permission(permission::i_video_max_camera_streams, this->getChannelId());
if(permission_max_camera_streams.has_value) {
if(!permission::v2::permission_granted(camera_streams, permission_max_camera_streams, false)) {
return ts::command_result{permission::i_video_max_camera_streams};
}
}
break;
}
case rtc::VideoBroadcastType::Screen:
if(!permission::v2::permission_granted(screen_streams, this->calculate_permission(permission::i_video_max_screen_streams, this->getChannelId()), false)) {
return ts::command_result{permission::i_video_max_screen_streams};
case rtc::VideoBroadcastType::Screen: {
const auto permission_max_screen_streams = this->calculate_permission(permission::i_video_max_camera_streams, this->getChannelId());
if(permission_max_screen_streams.has_value) {
if(!permission::v2::permission_granted(screen_streams, permission_max_screen_streams, false)) {
return ts::command_result{permission::i_video_max_screen_streams};
}
}
break;
}
default:
return ts::command_result{error::broadcast_invalid_type};