summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-08-14 01:03:27 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-08-14 01:03:27 +0200
commitf157602a52278519370c45cde4c9a0b12ede8d7e (patch)
tree26aaa10a71a1f44117605d4248c670a359427bb5 /src
parentBump flatpak dependency (diff)
downloadnheko-f157602a52278519370c45cde4c9a0b12ede8d7e.tar.xz
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!
Diffstat (limited to 'src')
-rw-r--r--src/CallManager.cpp4
-rw-r--r--src/TextInputWidget.cpp6
-rw-r--r--src/WebRTCSession.cpp68
3 files changed, 77 insertions, 1 deletions
diff --git a/src/CallManager.cpp b/src/CallManager.cpp
index 7ecabde0..32b82fdf 100644
--- a/src/CallManager.cpp
+++ b/src/CallManager.cpp
@@ -201,9 +201,13 @@ CallManager::onActiveCall()
 void
 CallManager::syncEvent(const mtx::events::collections::TimelineEvents &event)
 {
+#ifdef GSTREAMER_AVAILABLE
         if (handleEvent_<CallInvite>(event) || handleEvent_<CallCandidates>(event) ||
             handleEvent_<CallAnswer>(event) || handleEvent_<CallHangUp>(event))
                 return;
+#else
+        (void)event;
+#endif
 }
 
 template<typename T>
diff --git a/src/TextInputWidget.cpp b/src/TextInputWidget.cpp
index 9aadc101..a3392170 100644
--- a/src/TextInputWidget.cpp
+++ b/src/TextInputWidget.cpp
@@ -453,12 +453,14 @@ TextInputWidget::TextInputWidget(QWidget *parent)
         topLayout_->setSpacing(0);
         topLayout_->setContentsMargins(13, 1, 13, 0);
 
+#ifdef GSTREAMER_AVAILABLE
         callBtn_ = new FlatButton(this);
         changeCallButtonState(WebRTCSession::State::DISCONNECTED);
         connect(&WebRTCSession::instance(),
                 &WebRTCSession::stateChanged,
                 this,
                 &TextInputWidget::changeCallButtonState);
+#endif
 
         QIcon send_file_icon;
         send_file_icon.addFile(":/icons/icons/ui/paper-clip-outline.png");
@@ -528,7 +530,9 @@ TextInputWidget::TextInputWidget(QWidget *parent)
         emojiBtn_->setIcon(emoji_icon);
         emojiBtn_->setIconSize(QSize(ButtonHeight, ButtonHeight));
 
+#ifdef GSTREAMER_AVAILABLE
         topLayout_->addWidget(callBtn_);
+#endif
         topLayout_->addWidget(sendFileBtn_);
         topLayout_->addWidget(input_);
         topLayout_->addWidget(emojiBtn_);
@@ -536,7 +540,9 @@ TextInputWidget::TextInputWidget(QWidget *parent)
 
         setLayout(topLayout_);
 
+#ifdef GSTREAMER_AVAILABLE
         connect(callBtn_, &FlatButton::clicked, this, &TextInputWidget::callButtonPress);
+#endif
         connect(sendMessageBtn_, &FlatButton::clicked, input_, &FilteredTextEdit::submit);
         connect(sendFileBtn_, SIGNAL(clicked()), this, SLOT(openFileSelection()));
         connect(input_, &FilteredTextEdit::message, this, &TextInputWidget::sendTextMessage);
diff --git a/src/WebRTCSession.cpp b/src/WebRTCSession.cpp
index 5638c607..dd1dd61f 100644
--- a/src/WebRTCSession.cpp
+++ b/src/WebRTCSession.cpp
@@ -3,6 +3,7 @@
 #include "Logging.h"
 #include "WebRTCSession.h"
 
+#ifdef GSTREAMER_AVAILABLE
 extern "C"
 {
 #include "gst/gst.h"
@@ -11,6 +12,7 @@ extern "C"
 #define GST_USE_UNSTABLE_API
 #include "gst/webrtc/webrtc.h"
 }
+#endif
 
 Q_DECLARE_METATYPE(WebRTCSession::State)
 
@@ -24,6 +26,7 @@ WebRTCSession::WebRTCSession()
 bool
 WebRTCSession::init(std::string *errorMessage)
 {
+#ifdef GSTREAMER_AVAILABLE
         if (initialised_)
                 return true;
 
@@ -81,10 +84,14 @@ WebRTCSession::init(std::string *errorMessage)
                         *errorMessage = strError;
         }
         return initialised_;
+#else
+        (void)errorMessage;
+        return false;
+#endif
 }
 
+#ifdef GSTREAMER_AVAILABLE
 namespace {
-
 bool isoffering_;
 std::string localsdp_;
 std::vector<mtx::events::msg::CallCandidates::Candidate> localcandidates_;
@@ -631,3 +638,62 @@ WebRTCSession::getAudioSourceNames(const std::string &defaultDevice)
         }
         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