Fix one-way video calls

This commit is contained in:
trilene 2020-12-17 12:45:54 -05:00 committed by Nicolas Werner
parent 7124024977
commit 459c59901e
4 changed files with 27 additions and 2 deletions

View File

@ -148,7 +148,7 @@ Rectangle {
} }
ImageButton { ImageButton {
visible: CallManager.isVideo visible: CallManager.haveLocalVideo
width: 24 width: 24
height: 24 height: 24
buttonTextColor: "#000000" buttonTextColor: "#000000"

View File

@ -25,6 +25,7 @@ class CallManager : public QObject
Q_PROPERTY(bool haveCallInvite READ haveCallInvite NOTIFY newInviteState) Q_PROPERTY(bool haveCallInvite READ haveCallInvite NOTIFY newInviteState)
Q_PROPERTY(bool isOnCall READ isOnCall NOTIFY newCallState) Q_PROPERTY(bool isOnCall READ isOnCall NOTIFY newCallState)
Q_PROPERTY(bool isVideo READ isVideo NOTIFY newInviteState) 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(webrtc::State callState READ callState NOTIFY newCallState)
Q_PROPERTY(QString callParty READ callParty NOTIFY newInviteState) Q_PROPERTY(QString callParty READ callParty NOTIFY newInviteState)
Q_PROPERTY(QString callPartyAvatarUrl READ callPartyAvatarUrl NOTIFY newInviteState) Q_PROPERTY(QString callPartyAvatarUrl READ callPartyAvatarUrl NOTIFY newInviteState)
@ -40,6 +41,7 @@ public:
bool haveCallInvite() const { return haveCallInvite_; } bool haveCallInvite() const { return haveCallInvite_; }
bool isOnCall() const { return session_.state() != webrtc::State::DISCONNECTED; } bool isOnCall() const { return session_.state() != webrtc::State::DISCONNECTED; }
bool isVideo() const { return isVideo_; } bool isVideo() const { return isVideo_; }
bool haveLocalVideo() const { return session_.haveLocalVideo(); }
webrtc::State callState() const { return session_.state(); } webrtc::State callState() const { return session_.state(); }
QString callParty() const { return callParty_; } QString callParty() const { return callParty_; }
QString callPartyAvatarUrl() const { return callPartyAvatarUrl_; } QString callPartyAvatarUrl() const { return callPartyAvatarUrl_; }

View File

@ -555,7 +555,10 @@ getResolution(GstPad *pad)
void void
addCameraView(GstElement *pipe, const std::pair<int, int> &videoCallSize) 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 *queue = gst_element_factory_make("queue", nullptr);
GstElement *videorate = gst_element_factory_make("videorate", nullptr); GstElement *videorate = gst_element_factory_make("videorate", nullptr);
gst_bin_add_many(GST_BIN(pipe), queue, videorate, nullptr); gst_bin_add_many(GST_BIN(pipe), queue, videorate, nullptr);
@ -1152,6 +1155,19 @@ WebRTCSession::addVideoPipeline(int vp8PayloadType)
return true; 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 bool
WebRTCSession::isMicMuted() const WebRTCSession::isMicMuted() const
{ {
@ -1326,6 +1342,12 @@ WebRTCSession::havePlugins(bool, std::string *)
return false; return false;
} }
bool
WebRTCSession::haveLocalVideo() const
{
return false;
}
bool bool
WebRTCSession::createOffer(bool) WebRTCSession::createOffer(bool)
{ {

View File

@ -43,6 +43,7 @@ public:
bool havePlugins(bool isVideo, std::string *errorMessage = nullptr); bool havePlugins(bool isVideo, std::string *errorMessage = nullptr);
webrtc::State state() const { return state_; } webrtc::State state() const { return state_; }
bool isVideo() const { return isVideo_; } bool isVideo() const { return isVideo_; }
bool haveLocalVideo() const;
bool isOffering() const { return isOffering_; } bool isOffering() const { return isOffering_; }
bool isRemoteVideoRecvOnly() const { return isRemoteVideoRecvOnly_; } bool isRemoteVideoRecvOnly() const { return isRemoteVideoRecvOnly_; }