From a90a31955f17029d0b21a10c70b424806e14d3db Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 5 Dec 2024 19:26:45 +0100 Subject: [PATCH] Simplify enabling video and fix not receiving video. Update SDK for speedup startup. --- Linphone/model/call/CallModel.cpp | 52 +++++-------------------------- Linphone/model/call/CallModel.hpp | 4 +-- Linphone/model/tool/ToolModel.cpp | 3 +- external/linphone-sdk | 2 +- 4 files changed, 10 insertions(+), 51 deletions(-) diff --git a/Linphone/model/call/CallModel.cpp b/Linphone/model/call/CallModel.cpp index ac9f3890..87c78fbf 100644 --- a/Linphone/model/call/CallModel.cpp +++ b/Linphone/model/call/CallModel.cpp @@ -70,7 +70,7 @@ void CallModel::accept(bool withVideo) { break; } } - activateLocalVideo(params, mMonitor->getCurrentParams(), withVideo); + activateLocalVideo(params, withVideo); mMonitor->acceptWithParams(params); emit localVideoEnabledChanged(withVideo); } @@ -130,57 +130,19 @@ void CallModel::setSpeakerMuted(bool isMuted) { emit speakerMutedChanged(isMuted); } -void CallModel::activateLocalVideo(std::shared_ptr ¶ms, - const std::shared_ptr ¤tParams, - bool enable) { +void CallModel::activateLocalVideo(std::shared_ptr ¶ms, bool enable) { + lInfo() << sLog() + .arg("Updating call with video enabled and media direction set to %1") + .arg((int)params->getVideoDirection()); params->enableVideo(true); - auto direction = currentParams ? currentParams->getVideoDirection() : params->getVideoDirection(); - 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; - */ + auto videoDirection = enable ? linphone::MediaDirection::SendRecv : linphone::MediaDirection::RecvOnly; params->setVideoDirection(videoDirection); } void CallModel::setLocalVideoEnabled(bool enabled) { mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); auto params = CoreModel::getInstance()->getCore()->createCallParams(mMonitor); - activateLocalVideo(params, mMonitor->getCurrentParams(), enabled); + activateLocalVideo(params, enabled); mMonitor->update(params); } diff --git a/Linphone/model/call/CallModel.hpp b/Linphone/model/call/CallModel.hpp index 6e1e1dcb..b9072776 100644 --- a/Linphone/model/call/CallModel.hpp +++ b/Linphone/model/call/CallModel.hpp @@ -85,9 +85,7 @@ public: int getScreenSharingIndex() const; void setVideoSourceDescriptorModel(std::shared_ptr model = nullptr); - static void activateLocalVideo(std::shared_ptr ¶ms, - const std::shared_ptr ¤tParams, - bool enable); + static void activateLocalVideo(std::shared_ptr ¶ms, bool enable); void sendDtmf(const QString &dtmf); diff --git a/Linphone/model/tool/ToolModel.cpp b/Linphone/model/tool/ToolModel.cpp index 5ae71909..f36f2244 100644 --- a/Linphone/model/tool/ToolModel.cpp +++ b/Linphone/model/tool/ToolModel.cpp @@ -167,11 +167,10 @@ bool ToolModel::createCall(const QString &sipAddress, SettingsModel::enableTones(core->getConfig(), true); } std::shared_ptr params = core->createCallParams(nullptr); - CallModel::activateLocalVideo(params, nullptr, localVideoEnabled); + CallModel::activateLocalVideo(params, localVideoEnabled); bool micEnabled = options.contains("microEnabled") ? options["microEnabled"].toBool() : true; params->enableMic(micEnabled); - params->enableVideo(localVideoEnabled); params->setMediaEncryption(mediaEncryption); if (Utils::coreStringToAppString(params->getRecordFile()).isEmpty()) { diff --git a/external/linphone-sdk b/external/linphone-sdk index 8115b7aa..c8d895cb 160000 --- a/external/linphone-sdk +++ b/external/linphone-sdk @@ -1 +1 @@ -Subproject commit 8115b7aa8af46a67f2d9618bc651930c10b9fe20 +Subproject commit c8d895cb162e0d6782d339e2ea3950ba2b8ca3da