From 80f964b2d50c5c3e219c7ce5136fc01297716a2e Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 12 Jun 2017 15:31:55 +0200 Subject: [PATCH] fix(src/components/call/CallModel): avoid video actions if the app was built without video support --- linphone-desktop/src/components/call/CallModel.cpp | 7 ++++++- linphone-desktop/src/components/calls/CallsListModel.cpp | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/linphone-desktop/src/components/call/CallModel.cpp b/linphone-desktop/src/components/call/CallModel.cpp index 7a4528e21..3bdda49d6 100644 --- a/linphone-desktop/src/components/call/CallModel.cpp +++ b/linphone-desktop/src/components/call/CallModel.cpp @@ -435,6 +435,12 @@ bool CallModel::getVideoEnabled () const { } void CallModel::setVideoEnabled (bool status) { + shared_ptr core = CoreManager::getInstance()->getCore(); + if (!core->videoSupported()) { + qWarning() << QStringLiteral("Unable to update video call property. (Video not supported.)"); + return; + } + switch (mCall->getState()) { case linphone::CallStateConnected: case linphone::CallStateStreamsRunning: @@ -445,7 +451,6 @@ void CallModel::setVideoEnabled (bool status) { if (status == getVideoEnabled()) return; - shared_ptr core = CoreManager::getInstance()->getCore(); shared_ptr params = core->createCallParams(mCall); params->enableVideo(status); diff --git a/linphone-desktop/src/components/calls/CallsListModel.cpp b/linphone-desktop/src/components/calls/CallsListModel.cpp index d905b504b..76ef8765d 100644 --- a/linphone-desktop/src/components/calls/CallsListModel.cpp +++ b/linphone-desktop/src/components/calls/CallsListModel.cpp @@ -93,8 +93,8 @@ void CallsListModel::askForTransfer (CallModel *callModel) { void CallsListModel::launchAudioCall (const QString &sipUri) const { shared_ptr core = CoreManager::getInstance()->getCore(); - shared_ptr address = core->interpretUrl(::Utils::appStringToCoreString(sipUri)); + shared_ptr address = core->interpretUrl(::Utils::appStringToCoreString(sipUri)); if (!address) return; @@ -107,8 +107,13 @@ void CallsListModel::launchAudioCall (const QString &sipUri) const { void CallsListModel::launchVideoCall (const QString &sipUri) const { shared_ptr core = CoreManager::getInstance()->getCore(); - shared_ptr address = core->interpretUrl(::Utils::appStringToCoreString(sipUri)); + if (!core->videoSupported()) { + qWarning() << QStringLiteral("Unable to launch video call. (Video not supported.) Launching audio call..."); + launchAudioCall(sipUri); + return; + } + shared_ptr address = core->interpretUrl(::Utils::appStringToCoreString(sipUri)); if (!address) return;