summary refs log tree commit diff
path: root/src/WebRTCSession.h
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-10-08 16:57:03 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-10-08 16:57:03 +0200
commit99ba1f17d3b7c7cb83c913c17c3f58eccfe3e1f6 (patch)
treeb337a2a83b3795518f6f82bbad85938fea40d916 /src/WebRTCSession.h
parentImplement signature upload for own master key (diff)
parentMerge pull request #294 from trilene/master (diff)
downloadnheko-99ba1f17d3b7c7cb83c913c17c3f58eccfe3e1f6.tar.xz
Merge remote-tracking branch 'origin/master' into cross-signing
Diffstat (limited to 'src/WebRTCSession.h')
-rw-r--r--src/WebRTCSession.h42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/WebRTCSession.h b/src/WebRTCSession.h

index 653ec2cf..83cabf5c 100644 --- a/src/WebRTCSession.h +++ b/src/WebRTCSession.h
@@ -9,23 +9,30 @@ typedef struct _GstElement GstElement; +namespace webrtc { +Q_NAMESPACE + +enum class State +{ + DISCONNECTED, + ICEFAILED, + INITIATING, + INITIATED, + OFFERSENT, + ANSWERSENT, + CONNECTING, + CONNECTED + +}; +Q_ENUM_NS(State) + +} + class WebRTCSession : public QObject { Q_OBJECT public: - enum class State - { - DISCONNECTED, - ICEFAILED, - INITIATING, - INITIATED, - OFFERSENT, - ANSWERSENT, - CONNECTING, - CONNECTED - }; - static WebRTCSession &instance() { static WebRTCSession instance; @@ -33,14 +40,15 @@ public: } bool init(std::string *errorMessage = nullptr); - State state() const { return state_; } + webrtc::State state() const { return state_; } bool createOffer(); bool acceptOffer(const std::string &sdp); bool acceptAnswer(const std::string &sdp); void acceptICECandidates(const std::vector<mtx::events::msg::CallCandidates::Candidate> &); - bool toggleMuteAudioSrc(bool &isMuted); + bool isMicMuted() const; + bool toggleMicMute(); void end(); void setStunServer(const std::string &stunServer) { stunServer_ = stunServer; } @@ -55,16 +63,16 @@ signals: void answerCreated(const std::string &sdp, const std::vector<mtx::events::msg::CallCandidates::Candidate> &); void newICECandidate(const mtx::events::msg::CallCandidates::Candidate &); - void stateChanged(WebRTCSession::State); // explicit qualifier necessary for Qt + void stateChanged(webrtc::State); private slots: - void setState(State state) { state_ = state; } + void setState(webrtc::State state) { state_ = state; } private: WebRTCSession(); bool initialised_ = false; - State state_ = State::DISCONNECTED; + webrtc::State state_ = webrtc::State::DISCONNECTED; GstElement *pipe_ = nullptr; GstElement *webrtc_ = nullptr; unsigned int busWatchId_ = 0;