disable camera when accepting audio call #LINQT-2422

force automatically_accept_direction to ReceiveOnly on migration

fix enableVideo value
This commit is contained in:
gaelle 2026-02-16 17:27:44 +01:00 committed by Gaelle Braud
parent 06266a49b1
commit 1d2eefe729
2 changed files with 15 additions and 4 deletions

View file

@ -67,6 +67,11 @@ void CallModel::accept(bool withVideo) {
}
}
activateLocalVideo(params, withVideo);
params->enableCamera(withVideo);
lInfo() << log()
.arg("Accept call with params : enableVideo = %1 | enableCamera = %2")
.arg(params->videoEnabled())
.arg(params->cameraEnabled());
mMonitor->acceptWithParams(params);
emit localVideoEnabledChanged(withVideo);
emit cameraEnabledChanged(withVideo && params->cameraEnabled());
@ -144,12 +149,17 @@ bool CallModel::videoEnabled() const {
void CallModel::activateLocalVideo(std::shared_ptr<linphone::CallParams> &params, bool enable) {
lInfo() << sLog()
.arg("Updating call with video enabled and media direction set to %1")
.arg("Updating call with video enabled = %1 and media direction set to %2")
.arg(params->videoEnabled())
.arg((int)params->getVideoDirection());
params->enableVideo(SettingsModel::getInstance()->getVideoEnabled());
auto videoDirection = params->getVideoDirection();
params->setVideoDirection(enable || params->screenSharingEnabled() ? linphone::MediaDirection::SendRecv
: linphone::MediaDirection::RecvOnly);
lInfo() << sLog()
.arg("Call updated with video enabled = %1 media direction set to %2")
.arg(params->videoEnabled())
.arg((int)params->getVideoDirection());
}
void CallModel::setLocalVideoEnabled(bool enabled) {
@ -459,7 +469,8 @@ void CallModel::onStateChanged(const std::shared_ptr<linphone::Call> &call,
auto params = call->getParams();
auto videoDirection = params->getVideoDirection();
auto remoteVideoDirection = call->getRemoteParams()->getVideoDirection();
lInfo() << log().arg("Camera enabled changed") << params->cameraEnabled();
lInfo() << log().arg("State changed, camera enabled =") << params->cameraEnabled()
<< "| video direction =" << (int)videoDirection;
emit localVideoEnabledChanged(videoDirection == linphone::MediaDirection::SendOnly ||
videoDirection == linphone::MediaDirection::SendRecv);
emit cameraEnabledChanged((videoDirection == linphone::MediaDirection::SendOnly ||

View file

@ -356,7 +356,7 @@ void CoreModel::migrate() {
// these when core is ready.
if (!config->hasEntry("video", "automatically_accept")) config->setInt("video", "automatically_accept", 1);
if (!config->hasEntry("video", "automatically_initiate")) config->setInt("video", "automatically_initiate", 0);
if (!config->hasEntry("video", "automatically_accept_direction"))
// Force automatically accept direction to receive only for 6.x version for asymetrical video
config->setInt("video", "automatically_accept_direction", 2);
lInfo() << log().arg("Migrating) Video Policy for version 7.");
}