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 &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); @@ -1152,6 +1155,19 @@ WebRTCSession::addVideoPipeline(int vp8PayloadType) return true; } +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 { @@ -1326,6 +1342,12 @@ WebRTCSession::havePlugins(bool, std::string *) return false; } +bool +WebRTCSession::haveLocalVideo() const +{ + return false; +} + bool WebRTCSession::createOffer(bool) { 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_; }