Skip to content

Commit

Permalink
Merge branch 'task/cht-1233-fix-clc' into 'develop'
Browse files Browse the repository at this point in the history
CHT-1233. Missing code in mclc_commands.cpp file

See merge request megachat/MEGAchat!1905
  • Loading branch information
jgandres committed Apr 29, 2024
2 parents 25ac38a + f98c3d6 commit d728dbd
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion examples/megaclc/mclc_commands.cpp
Expand Up @@ -1424,6 +1424,30 @@ void exec_joinCallViaMeetingLink(ac::ACState& s)
waitTimeSec = clc_ccactions::callUnlimitedDuration;
}

std::string recvVideosStr{"0"};
s.extractflagparam("-recvNumLowVideos", recvVideosStr);
int numRecvLowVideos = std::stoi(recvVideosStr);
if (numRecvLowVideos < clc_report::CLCCallReceivedVideos::NUM_FOR_INFINITE_VIDEO_RECEIVERS)
{
const char* msg = "Invalid value for recvNumLowVideos.";
logMsg(m::logError, msg, ELogWriter::MEGA_CHAT);
clc_console::conlock(std::cout) << msg << "\n";
return;
}

recvVideosStr = "0";
s.extractflagparam("-recvNumHighVideos", recvVideosStr);
int numRecvHighVideos = std::stoi(recvVideosStr);
if (numRecvHighVideos < clc_report::CLCCallReceivedVideos::NUM_FOR_INFINITE_VIDEO_RECEIVERS)
{
const char* msg = "Invalid value for recvNumHighVideos.";
logMsg(m::logError, msg, ELogWriter::MEGA_CHAT);
clc_console::conlock(std::cout) << msg << "\n";
return;
}
clc_global::g_callVideoParticipants.resetNumberOfLowResVideo(numRecvLowVideos);
clc_global::g_callVideoParticipants.resetNumberOfHighResVideo(numRecvHighVideos);

std::string videoInputDevice;
s.extractflagparam("-videoInputDevice", videoInputDevice);
if (videoInputDevice.size() != 0)
Expand Down Expand Up @@ -1463,6 +1487,18 @@ void exec_joinCallViaMeetingLink(ac::ACState& s)
return;
}

std::unique_ptr<megachat::MegaChatCall> call(g_chatApi->getChatCall(chatId));
if (!call)
{
// The call must exists as it existed in answerCall function
logMsg(m::logError,
"exec_joinCallViaMeetingLink: Call cannot be retrieved for chatid",
ELogWriter::MEGA_CHAT);
assert(false);
return;
}
clc_global::g_callVideoParticipants.setCallId(call->getCallId());

logMsg(m::logInfo, "## Task4: Answer chat call ##", ELogWriter::MEGA_CHAT);
if (!clc_ccactions::answerCall(chatId,
audio,
Expand All @@ -1472,7 +1508,7 @@ void exec_joinCallViaMeetingLink(ac::ACState& s)
return;
}
// Log number of participants
std::unique_ptr<megachat::MegaChatCall> call(g_chatApi->getChatCall(chatId));
call.reset(g_chatApi->getChatCall(chatId));
if (!call)
{
// The call must exists as it existed in answerCall function
Expand Down

0 comments on commit d728dbd

Please sign in to comment.