diff options
author | trilene <trilene@runbox.com> | 2020-12-17 12:45:54 -0500 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2021-01-07 14:04:21 +0100 |
commit | 459c59901e85d5ac4e04b48ba68a046142ea5bf8 (patch) | |
tree | 8064783d2d6b0303dae36d4b99dfb4ba5e70ac84 | |
parent | Make call invites less intrusive (diff) | |
download | nheko-459c59901e85d5ac4e04b48ba68a046142ea5bf8.tar.xz |
Fix one-way video calls
-rw-r--r-- | resources/qml/voip/ActiveCallBar.qml | 2 | ||||
-rw-r--r-- | src/CallManager.h | 2 | ||||
-rw-r--r-- | src/WebRTCSession.cpp | 24 | ||||
-rw-r--r-- | src/WebRTCSession.h | 1 |
4 files changed, 27 insertions, 2 deletions
diff --git a/resources/qml/voip/ActiveCallBar.qml b/resources/qml/voip/ActiveCallBar.qml index 9efdb325..a1ddd853 100644 --- a/resources/qml/voip/ActiveCallBar.qml +++ b/resources/qml/voip/ActiveCallBar.qml @@ -148,7 +148,7 @@ Rectangle { } ImageButton { - visible: CallManager.isVideo + visible: CallManager.haveLocalVideo width: 24 height: 24 buttonTextColor: "#000000" diff --git a/src/CallManager.h b/src/CallManager.h index e5571c88..ad25fbd1 100644 --- a/src/CallManager.h +++ b/src/CallManager.h @@ -25,6 +25,7 @@ class CallManager : public QObject Q_PROPERTY(bool haveCallInvite READ haveCallInvite NOTIFY newInviteState) Q_PROPERTY(bool isOnCall READ isOnCall NOTIFY newCallState) Q_PROPERTY(bool isVideo READ isVideo NOTIFY newInviteState) + Q_PROPERTY(bool haveLocalVideo READ haveLocalVideo NOTIFY newCallState) Q_PROPERTY(webrtc::State callState READ callState NOTIFY newCallState) Q_PROPERTY(QString callParty READ callParty NOTIFY newInviteState) Q_PROPERTY(QString callPartyAvatarUrl READ callPartyAvatarUrl NOTIFY newInviteState) @@ -40,6 +41,7 @@ public: bool haveCallInvite() const { return haveCallInvite_; } bool isOnCall() const { return session_.state() != webrtc::State::DISCONNECTED; } bool isVideo() const { return isVideo_; } + bool haveLocalVideo() const { return session_.haveLocalVideo(); } webrtc::State callState() const { return session_.state(); } QString callParty() const { return callParty_; } QString callPartyAvatarUrl() const { return callPartyAvatarUrl_; } diff --git a/src/WebRTCSession.cpp b/src/WebRTCSession.cpp index 90a693a4..a431ab54 100644 --- a/src/WebRTCSession.cpp +++ b/src/WebRTCSession.cpp @@ -555,7 +555,10 @@ getResolution(GstPad *pad) void addCameraView(GstElement *pipe, const std::pair<int, int> &videoCallSize) { - GstElement *tee = gst_bin_get_by_name(GST_BIN(pipe), "videosrctee"); + GstElement *tee = gst_bin_get_by_name(GST_BIN(pipe), "videosrctee"); + if (!tee) + return; + GstElement *queue = gst_element_factory_make("queue", nullptr); GstElement *videorate = gst_element_factory_make("videorate", nullptr); gst_bin_add_many(GST_BIN(pipe), queue, videorate, nullptr); @@ -1153,6 +1156,19 @@ WebRTCSession::addVideoPipeline(int vp8PayloadType) } bool +WebRTCSession::haveLocalVideo() const +{ + if (isVideo_ && state_ >= State::INITIATED) { + GstElement *tee = gst_bin_get_by_name(GST_BIN(pipe_), "videosrctee"); + if (tee) { + gst_object_unref(tee); + return true; + } + } + return false; +} + +bool WebRTCSession::isMicMuted() const { if (state_ < State::INITIATED) @@ -1327,6 +1343,12 @@ WebRTCSession::havePlugins(bool, std::string *) } bool +WebRTCSession::haveLocalVideo() const +{ + return false; +} + +bool WebRTCSession::createOffer(bool) { return false; diff --git a/src/WebRTCSession.h b/src/WebRTCSession.h index fe82725f..2f0fb70e 100644 --- a/src/WebRTCSession.h +++ b/src/WebRTCSession.h @@ -43,6 +43,7 @@ public: bool havePlugins(bool isVideo, std::string *errorMessage = nullptr); webrtc::State state() const { return state_; } bool isVideo() const { return isVideo_; } + bool haveLocalVideo() const; bool isOffering() const { return isOffering_; } bool isRemoteVideoRecvOnly() const { return isRemoteVideoRecvOnly_; } |