Simplify enabling video and fix not receiving video.

Update SDK for speedup startup.
This commit is contained in:
Julien Wadel 2024-12-05 19:26:45 +01:00
parent 5fc1296aa5
commit a90a31955f
4 changed files with 10 additions and 51 deletions

View file

@ -70,7 +70,7 @@ void CallModel::accept(bool withVideo) {
break; break;
} }
} }
activateLocalVideo(params, mMonitor->getCurrentParams(), withVideo); activateLocalVideo(params, withVideo);
mMonitor->acceptWithParams(params); mMonitor->acceptWithParams(params);
emit localVideoEnabledChanged(withVideo); emit localVideoEnabledChanged(withVideo);
} }
@ -130,57 +130,19 @@ void CallModel::setSpeakerMuted(bool isMuted) {
emit speakerMutedChanged(isMuted); emit speakerMutedChanged(isMuted);
} }
void CallModel::activateLocalVideo(std::shared_ptr<linphone::CallParams> &params, void CallModel::activateLocalVideo(std::shared_ptr<linphone::CallParams> &params, bool enable) {
const std::shared_ptr<const linphone::CallParams> &currentParams, lInfo() << sLog()
bool enable) { .arg("Updating call with video enabled and media direction set to %1")
.arg((int)params->getVideoDirection());
params->enableVideo(true); params->enableVideo(true);
auto direction = currentParams ? currentParams->getVideoDirection() : params->getVideoDirection(); auto videoDirection = enable ? linphone::MediaDirection::SendRecv : linphone::MediaDirection::RecvOnly;
auto videoDirection = linphone::MediaDirection::RecvOnly;
if (enable) { // +Send
switch (direction) {
case linphone::MediaDirection::RecvOnly:
videoDirection = linphone::MediaDirection::SendRecv;
break;
case linphone::MediaDirection::SendOnly:
videoDirection = linphone::MediaDirection::SendOnly;
break;
case linphone::MediaDirection::SendRecv:
videoDirection = linphone::MediaDirection::SendRecv;
break;
default:
videoDirection = linphone::MediaDirection::SendOnly;
}
} else { // -Send
switch (direction) {
case linphone::MediaDirection::RecvOnly:
videoDirection = linphone::MediaDirection::RecvOnly;
break;
case linphone::MediaDirection::SendOnly:
videoDirection = linphone::MediaDirection::Inactive;
break;
case linphone::MediaDirection::SendRecv:
videoDirection = linphone::MediaDirection::RecvOnly;
break;
default:
videoDirection = linphone::MediaDirection::Inactive;
}
}
/*
auto videoDirection =
!enabled ? linphone::MediaDirection::RecvOnly
: direction == linphone::MediaDirection::RecvOnly //
? linphone::MediaDirection::SendRecv
: direction == linphone::MediaDirection::SendRecv || direction == linphone::MediaDirection::SendOnly
? linphone::MediaDirection::RecvOnly
: linphone::MediaDirection::SendOnly;
*/
params->setVideoDirection(videoDirection); params->setVideoDirection(videoDirection);
} }
void CallModel::setLocalVideoEnabled(bool enabled) { void CallModel::setLocalVideoEnabled(bool enabled) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
auto params = CoreModel::getInstance()->getCore()->createCallParams(mMonitor); auto params = CoreModel::getInstance()->getCore()->createCallParams(mMonitor);
activateLocalVideo(params, mMonitor->getCurrentParams(), enabled); activateLocalVideo(params, enabled);
mMonitor->update(params); mMonitor->update(params);
} }

View file

@ -85,9 +85,7 @@ public:
int getScreenSharingIndex() const; int getScreenSharingIndex() const;
void setVideoSourceDescriptorModel(std::shared_ptr<VideoSourceDescriptorModel> model = nullptr); void setVideoSourceDescriptorModel(std::shared_ptr<VideoSourceDescriptorModel> model = nullptr);
static void activateLocalVideo(std::shared_ptr<linphone::CallParams> &params, static void activateLocalVideo(std::shared_ptr<linphone::CallParams> &params, bool enable);
const std::shared_ptr<const linphone::CallParams> &currentParams,
bool enable);
void sendDtmf(const QString &dtmf); void sendDtmf(const QString &dtmf);

View file

@ -167,11 +167,10 @@ bool ToolModel::createCall(const QString &sipAddress,
SettingsModel::enableTones(core->getConfig(), true); SettingsModel::enableTones(core->getConfig(), true);
} }
std::shared_ptr<linphone::CallParams> params = core->createCallParams(nullptr); std::shared_ptr<linphone::CallParams> params = core->createCallParams(nullptr);
CallModel::activateLocalVideo(params, nullptr, localVideoEnabled); CallModel::activateLocalVideo(params, localVideoEnabled);
bool micEnabled = options.contains("microEnabled") ? options["microEnabled"].toBool() : true; bool micEnabled = options.contains("microEnabled") ? options["microEnabled"].toBool() : true;
params->enableMic(micEnabled); params->enableMic(micEnabled);
params->enableVideo(localVideoEnabled);
params->setMediaEncryption(mediaEncryption); params->setMediaEncryption(mediaEncryption);
if (Utils::coreStringToAppString(params->getRecordFile()).isEmpty()) { if (Utils::coreStringToAppString(params->getRecordFile()).isEmpty()) {

@ -1 +1 @@
Subproject commit 8115b7aa8af46a67f2d9618bc651930c10b9fe20 Subproject commit c8d895cb162e0d6782d339e2ea3950ba2b8ca3da