Remove references to video calls

This commit is contained in:
trilene 2020-07-29 18:16:52 -04:00
parent 43ec0c0624
commit 97681ccf64
6 changed files with 21 additions and 30 deletions

View file

@ -110,7 +110,7 @@ ActiveCallBar::setCallParty(
const QString &avatarUrl) const QString &avatarUrl)
{ {
callPartyLabel_->setText(" " + callPartyLabel_->setText(" " +
(displayName.isEmpty() ? userid : displayName) + " -"); (displayName.isEmpty() ? userid : displayName) + " ");
if (!avatarUrl.isEmpty()) if (!avatarUrl.isEmpty())
avatar_->setImage(avatarUrl); avatar_->setImage(avatarUrl);
@ -142,7 +142,8 @@ ActiveCallBar::update(WebRTCSession::State state)
show(); show();
callStartTime_ = QDateTime::currentSecsSinceEpoch(); callStartTime_ = QDateTime::currentSecsSinceEpoch();
timer_->start(1000); 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_->setText("00:00");
durationLabel_->show(); durationLabel_->show();
break; break;

View file

@ -1,3 +1,4 @@
#include <cctype>
#include <chrono> #include <chrono>
#include <QMediaPlaylist> #include <QMediaPlaylist>
@ -198,12 +199,24 @@ CallManager::handleEvent_(const mtx::events::collections::TimelineEvents &event)
void void
CallManager::handleEvent(const RoomEvent<CallInvite> &callInviteEvent) CallManager::handleEvent(const RoomEvent<CallInvite> &callInviteEvent)
{ {
nhlog::ui()->debug("WebRTC: call id: {} - incoming CallInvite from {}", const char video[] = "m=video";
callInviteEvent.content.call_id, callInviteEvent.sender); 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()) if (callInviteEvent.content.call_id.empty())
return; 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); auto roomInfo = cache::singleRoomInfo(callInviteEvent.room_id);
if (onActiveCall() || roomInfo.member_count != 2) { if (onActiveCall() || roomInfo.member_count != 2) {
emit newMessage(QString::fromStdString(callInviteEvent.room_id), emit newMessage(QString::fromStdString(callInviteEvent.room_id),

View file

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

View file

@ -64,13 +64,13 @@ WebRTCSession::init(std::string *errorMessage)
// GStreamer Plugins: // GStreamer Plugins:
// Base: audioconvert, audioresample, opus, playback, volume // Base: audioconvert, audioresample, opus, playback, volume
// Good: autodetect, rtpmanager, vpx // Good: autodetect, rtpmanager
// Bad: dtls, srtp, webrtc // Bad: dtls, srtp, webrtc
// libnice [GLib]: nice // libnice [GLib]: nice
initialised_ = true; initialised_ = true;
std::string strError = gstVersion + ": Missing plugins: "; std::string strError = gstVersion + ": Missing plugins: ";
const gchar *needed[] = {"audioconvert", "audioresample", "autodetect", "dtls", "nice", 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(); GstRegistry *registry = gst_registry_get();
for (guint i = 0; i < g_strv_length((gchar**)needed); i++) { for (guint i = 0; i < g_strv_length((gchar**)needed); i++) {
GstPlugin *plugin = gst_registry_find_plugin(registry, 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); gst_caps_unref(caps);
GstPad *queuepad = nullptr; GstPad *queuepad = nullptr;
GstElement *queue = gst_element_factory_make("queue", nullptr);
if (g_str_has_prefix(name, "audio")) { if (g_str_has_prefix(name, "audio")) {
nhlog::ui()->debug("WebRTC: received incoming audio stream"); 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 *convert = gst_element_factory_make("audioconvert", nullptr);
GstElement *resample = gst_element_factory_make("audioresample", nullptr); GstElement *resample = gst_element_factory_make("audioresample", nullptr);
GstElement *sink = gst_element_factory_make("autoaudiosink", 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); gst_element_link_many(queue, convert, resample, sink, nullptr);
queuepad = gst_element_get_static_pad(queue, "sink"); 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 (queuepad) {
if (GST_PAD_LINK_FAILED(gst_pad_link(newpad, queuepad))) if (GST_PAD_LINK_FAILED(gst_pad_link(newpad, queuepad)))

View file

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

View file

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