summary refs log tree commit diff
path: root/src/WebRTCSession.h
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-10-30 03:21:14 +0100
committerGitHub <noreply@github.com>2020-10-30 03:21:14 +0100
commitb64e6e9cd59c97f3e4f88c08d6c13f2574921d80 (patch)
tree5e2ee4ecaf8523bc006e47bad7f277b0e21eee0f /src/WebRTCSession.h
parentFix clipboard image pasting crash on macos (diff)
parentUnused variable (diff)
downloadnheko-b64e6e9cd59c97f3e4f88c08d6c13f2574921d80.tar.xz
Merge pull request #311 from trilene/webrtc-video
Support video calls
Diffstat (limited to 'src/WebRTCSession.h')
-rw-r--r--src/WebRTCSession.h45
1 files changed, 30 insertions, 15 deletions
diff --git a/src/WebRTCSession.h b/src/WebRTCSession.h

index 83cabf5c..9c7778e7 100644 --- a/src/WebRTCSession.h +++ b/src/WebRTCSession.h
@@ -8,6 +8,7 @@ #include "mtx/events/voip.hpp" typedef struct _GstElement GstElement; +class QQuickItem; namespace webrtc { Q_NAMESPACE @@ -39,10 +40,13 @@ public: return instance; } - bool init(std::string *errorMessage = nullptr); + bool havePlugins(bool isVideo, std::string *errorMessage = nullptr); webrtc::State state() const { return state_; } + bool isVideo() const { return isVideo_; } + bool isOffering() const { return isOffering_; } + bool isRemoteVideoRecvOnly() const { return isRemoteVideoRecvOnly_; } - bool createOffer(); + bool createOffer(bool isVideo); bool acceptOffer(const std::string &sdp); bool acceptAnswer(const std::string &sdp); void acceptICECandidates(const std::vector<mtx::events::msg::CallCandidates::Candidate> &); @@ -51,11 +55,17 @@ public: bool toggleMicMute(); void end(); - void setStunServer(const std::string &stunServer) { stunServer_ = stunServer; } void setTurnServers(const std::vector<std::string> &uris) { turnServers_ = uris; } - std::vector<std::string> getAudioSourceNames(const std::string &defaultDevice); - void setAudioSource(int audioDeviceIndex) { audioSourceIndex_ = audioDeviceIndex; } + void refreshDevices(); + std::vector<std::string> getDeviceNames(bool isVideo, + const std::string &defaultDevice) const; + std::vector<std::string> getResolutions(const std::string &cameraName) const; + std::vector<std::string> getFrameRates(const std::string &cameraName, + const std::string &resolution) const; + + void setVideoItem(QQuickItem *item) { videoItem_ = item; } + QQuickItem *getVideoItem() const { return videoItem_; } signals: void offerCreated(const std::string &sdp, @@ -71,18 +81,23 @@ private slots: private: WebRTCSession(); - bool initialised_ = false; - webrtc::State state_ = webrtc::State::DISCONNECTED; - GstElement *pipe_ = nullptr; - GstElement *webrtc_ = nullptr; - unsigned int busWatchId_ = 0; - std::string stunServer_; + bool initialised_ = false; + bool haveVoicePlugins_ = false; + bool haveVideoPlugins_ = false; + webrtc::State state_ = webrtc::State::DISCONNECTED; + bool isVideo_ = false; + bool isOffering_ = false; + bool isRemoteVideoRecvOnly_ = false; + QQuickItem *videoItem_ = nullptr; + GstElement *pipe_ = nullptr; + GstElement *webrtc_ = nullptr; + unsigned int busWatchId_ = 0; std::vector<std::string> turnServers_; - int audioSourceIndex_ = -1; - bool startPipeline(int opusPayloadType); - bool createPipeline(int opusPayloadType); - void refreshDevices(); + bool init(std::string *errorMessage = nullptr); + bool startPipeline(int opusPayloadType, int vp8PayloadType); + bool createPipeline(int opusPayloadType, int vp8PayloadType); + bool addVideoPipeline(int vp8PayloadType); void startDeviceMonitor(); public: