Make asymetric video call

This commit is contained in:
Julien Wadel 2025-07-04 10:33:21 +02:00
parent fad42c88e8
commit 15642ab1b5
2 changed files with 13 additions and 19 deletions

View file

@ -426,21 +426,21 @@ bool CallModel::transferToAnother (const QString &peerAddress) {
}
// -----------------------------------------------------------------------------
void CallModel::acceptVideoRequest () {
void CallModel::acceptVideoRequest () {/*
if(mCall) {
shared_ptr<linphone::CallParams> params = CoreManager::getInstance()->getCore()->createCallParams(mCall);
params->enableVideo(true);
mCall->acceptUpdate(params);
}
}*/
}
void CallModel::rejectVideoRequest () {
void CallModel::rejectVideoRequest () {/*
if(mCall) {
shared_ptr<linphone::CallParams> params = CoreManager::getInstance()->getCore()->createCallParams(mCall);
params->enableVideo(false);
mCall->acceptUpdate(params);
}
}*/
}
void CallModel::takeSnapshot () {
@ -556,8 +556,8 @@ void CallModel::handleCallStateChanged (const shared_ptr<linphone::Call> &call,
case linphone::Call::State::UpdatedByRemote:
qDebug() << "UpdatedByRemote : " << (mCall ? QString( "Video enabled ? CurrentParams:") + mCall->getCurrentParams()->videoEnabled() + QString(", RemoteParams:")+mCall->getRemoteParams()->videoEnabled() : " call NULL");
if (mCall && !mCall->getCurrentParams()->videoEnabled() && mCall->getRemoteParams()->videoEnabled()) {
mCall->deferUpdate();
emit videoRequested();
//mCall->deferUpdate();
//emit videoRequested();
}
break;
@ -595,7 +595,8 @@ void CallModel::accept (bool withVideo) {
shared_ptr<linphone::Core> core = coreManager->getCore();
if(mCall) {
shared_ptr<linphone::CallParams> params = core->createCallParams(mCall);
params->enableVideo(withVideo);
params->enableVideo(CoreManager::getInstance()->getSettingsModel()->getVideoEnabled());
params->setVideoDirection(withVideo ? linphone::MediaDirection::SendRecv : linphone::MediaDirection::RecvOnly);
setRecordFile(params);
auto localAddress = mCall->getCallLog()->getLocalAddress();
for(auto account : coreManager->getAccountList()){
@ -792,10 +793,6 @@ bool CallModel::getCameraEnabled () const{
void CallModel::setCameraEnabled (bool status){
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
if (!CoreManager::getInstance()->getSettingsModel()->getVideoEnabled()) {
qWarning() << QStringLiteral("Unable to update video call property. (Video not enabled.)");
return;
}
if(mCall) {
switch (mCall->getState()) {
case linphone::Call::State::Connected:
@ -806,11 +803,8 @@ void CallModel::setCameraEnabled (bool status){
return;
}
}
if (status == getCameraEnabled())
return;
shared_ptr<linphone::CallParams> params = core->createCallParams(mCall);
params->enableVideo(true);
params->enableVideo(CoreManager::getInstance()->getSettingsModel()->getVideoEnabled());
params->setVideoDirection(status ? linphone::MediaDirection::SendRecv : linphone::MediaDirection::RecvOnly);
mCall->update(params);
}
@ -898,8 +892,8 @@ void CallModel::setVideoEnabled (bool status) {
return;
shared_ptr<linphone::CallParams> params = core->createCallParams(mCall);
params->enableVideo(status);
params->enableVideo(CoreManager::getInstance()->getSettingsModel()->getVideoEnabled());
params->setVideoDirection(status ? linphone::MediaDirection::SendRecv : linphone::MediaDirection::RecvOnly);
mCall->update(params);
}
}

View file

@ -596,8 +596,8 @@ Rectangle {
camera._activateCamera = true
}else
callModel.cameraEnabled = !callModel.cameraEnabled
}else{// In one-one, we deactivate all videos.
callModel.videoEnabled = !callModel.videoEnabled
}else{
callModel.cameraEnabled = !callModel.cameraEnabled
}
}
Connections{// Enable camera only when status is ok