Remove references to video calls

master
trilene 4 years ago
parent 43ec0c0624
commit 97681ccf64
  1. 5
      src/ActiveCallBar.cpp
  2. 17
      src/CallManager.cpp
  3. 3
      src/ChatPage.cpp
  4. 18
      src/WebRTCSession.cpp
  5. 6
      src/dialogs/PlaceCall.cpp
  6. 2
      src/dialogs/PlaceCall.h

@ -110,7 +110,7 @@ ActiveCallBar::setCallParty(
const QString &avatarUrl)
{
callPartyLabel_->setText(" " +
(displayName.isEmpty() ? userid : displayName) + " -");
(displayName.isEmpty() ? userid : displayName) + " ");
if (!avatarUrl.isEmpty())
avatar_->setImage(avatarUrl);
@ -142,7 +142,8 @@ ActiveCallBar::update(WebRTCSession::State state)
show();
callStartTime_ = QDateTime::currentSecsSinceEpoch();
timer_->start(1000);
stateLabel_->setText("Voice call:");
stateLabel_->setPixmap(QIcon(":/icons/icons/ui/place-call.png").
pixmap(QSize(buttonSize_, buttonSize_)));
durationLabel_->setText("00:00");
durationLabel_->show();
break;

@ -1,3 +1,4 @@
#include <cctype>
#include <chrono>
#include <QMediaPlaylist>
@ -198,12 +199,24 @@ CallManager::handleEvent_(const mtx::events::collections::TimelineEvents &event)
void
CallManager::handleEvent(const RoomEvent<CallInvite> &callInviteEvent)
{
nhlog::ui()->debug("WebRTC: call id: {} - incoming CallInvite from {}",
callInviteEvent.content.call_id, callInviteEvent.sender);
const char video[] = "m=video";
const std::string &sdp = callInviteEvent.content.sdp;
bool isVideo = std::search(sdp.cbegin(), sdp.cend(), std::cbegin(video), std::cend(video) - 1,
[](unsigned char c1, unsigned char c2) {return std::tolower(c1) == std::tolower(c2);})
!= sdp.cend();
nhlog::ui()->debug(std::string("WebRTC: call id: {} - incoming ") + (isVideo ? "video" : "voice") +
" CallInvite from {}", callInviteEvent.content.call_id, callInviteEvent.sender);
if (callInviteEvent.content.call_id.empty())
return;
if (isVideo) {
emit newMessage(QString::fromStdString(callInviteEvent.room_id),
CallHangUp{callInviteEvent.content.call_id, 0, CallHangUp::Reason::InviteTimeOut});
return;
}
auto roomInfo = cache::singleRoomInfo(callInviteEvent.room_id);
if (onActiveCall() || roomInfo.member_count != 2) {
emit newMessage(QString::fromStdString(callInviteEvent.room_id),

@ -479,9 +479,6 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
connect(dialog, &dialogs::PlaceCall::voice, this, [this]() {
callManager_.sendInvite(current_room_);
});
/*connect(dialog, &dialogs::PlaceCall::video, this, [this]() {
showNotification("Video calls not yet implemented.");
});*/
utils::centerWidget(dialog, MainWindow::instance());
dialog->show();
}

@ -64,13 +64,13 @@ WebRTCSession::init(std::string *errorMessage)
// GStreamer Plugins:
// Base: audioconvert, audioresample, opus, playback, volume
// Good: autodetect, rtpmanager, vpx
// Good: autodetect, rtpmanager
// Bad: dtls, srtp, webrtc
// libnice [GLib]: nice
initialised_ = true;
std::string strError = gstVersion + ": Missing plugins: ";
const gchar *needed[] = {"audioconvert", "audioresample", "autodetect", "dtls", "nice",
"opus", "playback", "rtpmanager", "srtp", "vpx", "volume", "webrtc", nullptr};
"opus", "playback", "rtpmanager", "srtp", "volume", "webrtc", nullptr};
GstRegistry *registry = gst_registry_get();
for (guint i = 0; i < g_strv_length((gchar**)needed); i++) {
GstPlugin *plugin = gst_registry_find_plugin(registry, needed[i]);
@ -462,10 +462,9 @@ linkNewPad(GstElement *decodebin G_GNUC_UNUSED, GstPad *newpad, GstElement *pipe
gst_caps_unref(caps);
GstPad *queuepad = nullptr;
GstElement *queue = gst_element_factory_make("queue", nullptr);
if (g_str_has_prefix(name, "audio")) {
nhlog::ui()->debug("WebRTC: received incoming audio stream");
GstElement *queue = gst_element_factory_make("queue", nullptr);
GstElement *convert = gst_element_factory_make("audioconvert", nullptr);
GstElement *resample = gst_element_factory_make("audioresample", nullptr);
GstElement *sink = gst_element_factory_make("autoaudiosink", nullptr);
@ -477,17 +476,6 @@ linkNewPad(GstElement *decodebin G_GNUC_UNUSED, GstPad *newpad, GstElement *pipe
gst_element_link_many(queue, convert, resample, sink, nullptr);
queuepad = gst_element_get_static_pad(queue, "sink");
}
else if (g_str_has_prefix(name, "video")) {
nhlog::ui()->debug("WebRTC: received incoming video stream");
GstElement *convert = gst_element_factory_make("videoconvert", nullptr);
GstElement *sink = gst_element_factory_make("autovideosink", nullptr);
gst_bin_add_many(GST_BIN(pipe), queue, convert, sink, nullptr);
gst_element_sync_state_with_parent(queue);
gst_element_sync_state_with_parent(convert);
gst_element_sync_state_with_parent(sink);
gst_element_link_many(queue, convert, sink, nullptr);
queuepad = gst_element_get_static_pad(queue, "sink");
}
if (queuepad) {
if (GST_PAD_LINK_FAILED(gst_pad_link(newpad, queuepad)))

@ -40,13 +40,11 @@ PlaceCall::PlaceCall(
voiceBtn_ = new QPushButton(tr("Voice Call"), this);
voiceBtn_->setDefault(true);
//videoBtn_ = new QPushButton(tr("Video Call"), this);
cancelBtn_ = new QPushButton(tr("Cancel"), this);
buttonLayout->addStretch(1);
buttonLayout->addWidget(avatar);
buttonLayout->addWidget(voiceBtn_);
//buttonLayout->addWidget(videoBtn_);
buttonLayout->addWidget(cancelBtn_);
QString name = displayName.isEmpty() ? callee : displayName;
@ -59,10 +57,6 @@ PlaceCall::PlaceCall(
emit voice();
emit close();
});
/*connect(videoBtn_, &QPushButton::clicked, this, [this]() {
emit video();
emit close();
});*/
connect(cancelBtn_, &QPushButton::clicked, this, [this]() {
emit cancel();
emit close();

@ -21,12 +21,10 @@ public:
signals:
void voice();
// void video();
void cancel();
private:
QPushButton *voiceBtn_;
// QPushButton *videoBtn_;
QPushButton *cancelBtn_;
};

Loading…
Cancel
Save