#ifndef TGVOIP_WEBRTC_MANAGER_H #define TGVOIP_WEBRTC_MANAGER_H #include "ThreadLocalObject.h" #include "NetworkManager.h" #include "MediaManager.h" #include "TgVoip.h" #ifdef TGVOIP_NAMESPACE namespace TGVOIP_NAMESPACE { #endif class Manager : public std::enable_shared_from_this { public: enum class VideoState { possible, outgoingRequested, incomingRequested, active }; static rtc::Thread *getMediaThread(); Manager( rtc::Thread *thread, TgVoipEncryptionKey encryptionKey, bool enableP2P, std::vector const &rtcServers, std::shared_ptr videoCapture, std::function stateUpdated, std::function remoteVideoIsActiveUpdated, std::function &)> signalingDataEmitted ); ~Manager(); void start(); void receiveSignalingData(const std::vector &data); void requestVideo(std::shared_ptr videoCapture); void acceptVideo(std::shared_ptr videoCapture); void setMuteOutgoingAudio(bool mute); void notifyIsLocalVideoActive(bool isActive); void setIncomingVideoOutput(std::shared_ptr> sink); private: rtc::Thread *_thread; TgVoipEncryptionKey _encryptionKey; bool _enableP2P; std::vector _rtcServers; std::shared_ptr _videoCapture; std::function _stateUpdated; std::function _remoteVideoIsActiveUpdated; std::function &)> _signalingDataEmitted; std::unique_ptr> _networkManager; std::unique_ptr> _mediaManager; TgVoipState _state; VideoState _videoState; bool _didConnectOnce; private: }; #ifdef TGVOIP_NAMESPACE } #endif #endif