#ifndef TGCALLS_GROUP_INSTANCE_IMPL_H #define TGCALLS_GROUP_INSTANCE_IMPL_H #include #include #include #include #include #include "../Instance.h" namespace webrtc { class AudioDeviceModule; class TaskQueueFactory; } namespace tgcalls { class LogSinkImpl; class GroupInstanceManager; struct GroupConfig { FilePath logPath; }; struct GroupLevelValue { float level = 0.; bool voice = false; }; struct GroupLevelUpdate { uint32_t ssrc = 0; GroupLevelValue value; }; struct GroupLevelsUpdate { std::vector updates; }; struct GroupInstanceDescriptor { GroupConfig config; std::function networkStateUpdated; std::function audioLevelsUpdated; std::string initialInputDeviceId; std::string initialOutputDeviceId; bool debugIgnoreMissingSsrcs = false; std::shared_ptr platformContext; }; struct GroupJoinPayloadFingerprint { std::string hash; std::string setup; std::string fingerprint; }; struct GroupJoinPayload { std::string ufrag; std::string pwd; std::vector fingerprints; uint32_t ssrc = 0; }; struct GroupJoinResponseCandidate { std::string port; std::string protocol; std::string network; std::string generation; std::string id; std::string component; std::string foundation; std::string priority; std::string ip; std::string type; std::string tcpType; std::string relAddr; std::string relPort; }; struct GroupJoinResponsePayload { std::string ufrag; std::string pwd; std::vector fingerprints; std::vector candidates; }; template class ThreadLocalObject; class GroupInstanceImpl final { public: explicit GroupInstanceImpl(GroupInstanceDescriptor &&descriptor); ~GroupInstanceImpl(); void stop(); void emitJoinPayload(std::function completion); void setJoinResponsePayload(GroupJoinResponsePayload payload); void removeSsrcs(std::vector ssrcs); void setIsMuted(bool isMuted); void setAudioOutputDevice(std::string id); void setAudioInputDevice(std::string id); void setVolume(uint32_t ssrc, double volume); struct AudioDevice { enum class Type {Input, Output}; std::string name; std::string guid; }; static std::vector getAudioDevices(AudioDevice::Type type); private: std::unique_ptr> _manager; std::unique_ptr _logSink; }; } // namespace tgcalls #endif