mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Disable call support, when GStreamer is unavailable
Integrating that in our CI is currently a bit hard, so disable it for now, if GStreamer isn't found. Just make sure to build against GStreamer for call support!
This commit is contained in:
parent
29cb065102
commit
f157602a52
4 changed files with 83 additions and 5 deletions
|
@ -427,8 +427,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
pkg_check_modules(GST_SDP REQUIRED IMPORTED_TARGET gstreamer-sdp-1.0>=1.14)
|
pkg_check_modules(GSTREAMER IMPORTED_TARGET gstreamer-sdp-1.0>=1.14 gstreamer-webrtc-1.0>=1.14)
|
||||||
pkg_check_modules(GST_WEBRTC REQUIRED IMPORTED_TARGET gstreamer-webrtc-1.0>=1.14)
|
|
||||||
|
|
||||||
# single instance functionality
|
# single instance functionality
|
||||||
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
|
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
|
||||||
|
@ -595,8 +594,6 @@ target_link_libraries(nheko PRIVATE
|
||||||
lmdbxx::lmdbxx
|
lmdbxx::lmdbxx
|
||||||
liblmdb::lmdb
|
liblmdb::lmdb
|
||||||
tweeny
|
tweeny
|
||||||
PkgConfig::GST_SDP
|
|
||||||
PkgConfig::GST_WEBRTC
|
|
||||||
SingleApplication::SingleApplication)
|
SingleApplication::SingleApplication)
|
||||||
|
|
||||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
||||||
|
@ -606,6 +603,11 @@ target_precompile_headers(nheko
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (TARGET PkgConfig::GSTREAMER)
|
||||||
|
target_link_libraries(nheko PRIVATE PkgConfig::GSTREAMER)
|
||||||
|
target_compile_definitions(nheko PRIVATE GSTREAMER_AVAILABLE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_link_libraries(nheko PRIVATE ntdll)
|
target_link_libraries(nheko PRIVATE ntdll)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -201,9 +201,13 @@ CallManager::onActiveCall()
|
||||||
void
|
void
|
||||||
CallManager::syncEvent(const mtx::events::collections::TimelineEvents &event)
|
CallManager::syncEvent(const mtx::events::collections::TimelineEvents &event)
|
||||||
{
|
{
|
||||||
|
#ifdef GSTREAMER_AVAILABLE
|
||||||
if (handleEvent_<CallInvite>(event) || handleEvent_<CallCandidates>(event) ||
|
if (handleEvent_<CallInvite>(event) || handleEvent_<CallCandidates>(event) ||
|
||||||
handleEvent_<CallAnswer>(event) || handleEvent_<CallHangUp>(event))
|
handleEvent_<CallAnswer>(event) || handleEvent_<CallHangUp>(event))
|
||||||
return;
|
return;
|
||||||
|
#else
|
||||||
|
(void)event;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -453,12 +453,14 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
||||||
topLayout_->setSpacing(0);
|
topLayout_->setSpacing(0);
|
||||||
topLayout_->setContentsMargins(13, 1, 13, 0);
|
topLayout_->setContentsMargins(13, 1, 13, 0);
|
||||||
|
|
||||||
|
#ifdef GSTREAMER_AVAILABLE
|
||||||
callBtn_ = new FlatButton(this);
|
callBtn_ = new FlatButton(this);
|
||||||
changeCallButtonState(WebRTCSession::State::DISCONNECTED);
|
changeCallButtonState(WebRTCSession::State::DISCONNECTED);
|
||||||
connect(&WebRTCSession::instance(),
|
connect(&WebRTCSession::instance(),
|
||||||
&WebRTCSession::stateChanged,
|
&WebRTCSession::stateChanged,
|
||||||
this,
|
this,
|
||||||
&TextInputWidget::changeCallButtonState);
|
&TextInputWidget::changeCallButtonState);
|
||||||
|
#endif
|
||||||
|
|
||||||
QIcon send_file_icon;
|
QIcon send_file_icon;
|
||||||
send_file_icon.addFile(":/icons/icons/ui/paper-clip-outline.png");
|
send_file_icon.addFile(":/icons/icons/ui/paper-clip-outline.png");
|
||||||
|
@ -528,7 +530,9 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
||||||
emojiBtn_->setIcon(emoji_icon);
|
emojiBtn_->setIcon(emoji_icon);
|
||||||
emojiBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight));
|
emojiBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight));
|
||||||
|
|
||||||
|
#ifdef GSTREAMER_AVAILABLE
|
||||||
topLayout_->addWidget(callBtn_);
|
topLayout_->addWidget(callBtn_);
|
||||||
|
#endif
|
||||||
topLayout_->addWidget(sendFileBtn_);
|
topLayout_->addWidget(sendFileBtn_);
|
||||||
topLayout_->addWidget(input_);
|
topLayout_->addWidget(input_);
|
||||||
topLayout_->addWidget(emojiBtn_);
|
topLayout_->addWidget(emojiBtn_);
|
||||||
|
@ -536,7 +540,9 @@ TextInputWidget::TextInputWidget(QWidget *parent)
|
||||||
|
|
||||||
setLayout(topLayout_);
|
setLayout(topLayout_);
|
||||||
|
|
||||||
|
#ifdef GSTREAMER_AVAILABLE
|
||||||
connect(callBtn_, &FlatButton::clicked, this, &TextInputWidget::callButtonPress);
|
connect(callBtn_, &FlatButton::clicked, this, &TextInputWidget::callButtonPress);
|
||||||
|
#endif
|
||||||
connect(sendMessageBtn_, &FlatButton::clicked, input_, &FilteredTextEdit::submit);
|
connect(sendMessageBtn_, &FlatButton::clicked, input_, &FilteredTextEdit::submit);
|
||||||
connect(sendFileBtn_, SIGNAL(clicked()), this, SLOT(openFileSelection()));
|
connect(sendFileBtn_, SIGNAL(clicked()), this, SLOT(openFileSelection()));
|
||||||
connect(input_, &FilteredTextEdit::message, this, &TextInputWidget::sendTextMessage);
|
connect(input_, &FilteredTextEdit::message, this, &TextInputWidget::sendTextMessage);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "WebRTCSession.h"
|
#include "WebRTCSession.h"
|
||||||
|
|
||||||
|
#ifdef GSTREAMER_AVAILABLE
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include "gst/gst.h"
|
#include "gst/gst.h"
|
||||||
|
@ -11,6 +12,7 @@ extern "C"
|
||||||
#define GST_USE_UNSTABLE_API
|
#define GST_USE_UNSTABLE_API
|
||||||
#include "gst/webrtc/webrtc.h"
|
#include "gst/webrtc/webrtc.h"
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(WebRTCSession::State)
|
Q_DECLARE_METATYPE(WebRTCSession::State)
|
||||||
|
|
||||||
|
@ -24,6 +26,7 @@ WebRTCSession::WebRTCSession()
|
||||||
bool
|
bool
|
||||||
WebRTCSession::init(std::string *errorMessage)
|
WebRTCSession::init(std::string *errorMessage)
|
||||||
{
|
{
|
||||||
|
#ifdef GSTREAMER_AVAILABLE
|
||||||
if (initialised_)
|
if (initialised_)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -81,10 +84,14 @@ WebRTCSession::init(std::string *errorMessage)
|
||||||
*errorMessage = strError;
|
*errorMessage = strError;
|
||||||
}
|
}
|
||||||
return initialised_;
|
return initialised_;
|
||||||
|
#else
|
||||||
|
(void)errorMessage;
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GSTREAMER_AVAILABLE
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool isoffering_;
|
bool isoffering_;
|
||||||
std::string localsdp_;
|
std::string localsdp_;
|
||||||
std::vector<mtx::events::msg::CallCandidates::Candidate> localcandidates_;
|
std::vector<mtx::events::msg::CallCandidates::Candidate> localcandidates_;
|
||||||
|
@ -631,3 +638,62 @@ WebRTCSession::getAudioSourceNames(const std::string &defaultDevice)
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
bool
|
||||||
|
WebRTCSession::createOffer()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
WebRTCSession::acceptOffer(const std::string &)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
WebRTCSession::acceptAnswer(const std::string &)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WebRTCSession::acceptICECandidates(const std::vector<mtx::events::msg::CallCandidates::Candidate> &)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool
|
||||||
|
WebRTCSession::startPipeline(int)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
WebRTCSession::createPipeline(int)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
WebRTCSession::toggleMuteAudioSrc(bool &)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WebRTCSession::end()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WebRTCSession::refreshDevices()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string>
|
||||||
|
WebRTCSession::getAudioSourceNames(const std::string &)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue