/** * libdatachannel streamer example * Copyright (c) 2020 Filip Klembara (in2core) * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #ifndef helpers_hpp #define helpers_hpp #include "rtc/rtc.hpp" #include struct ClientTrackData { std::shared_ptr track; std::shared_ptr sender; ClientTrackData(std::shared_ptr track, std::shared_ptr sender); }; struct Client { enum class State { Waiting, WaitingForVideo, WaitingForAudio, Ready }; const std::shared_ptr & peerConnection = _peerConnection; Client(std::shared_ptr pc) { _peerConnection = pc; } std::optional> video; std::optional> audio; std::optional> dataChannel; void setState(State state); State getState(); uint32_t rtpStartTimestamp = 0; private: std::shared_mutex _mutex; State state = State::Waiting; std::string id; std::shared_ptr _peerConnection; }; struct ClientTrack { std::string id; std::shared_ptr trackData; ClientTrack(std::string id, std::shared_ptr trackData); }; uint64_t currentTimeInMicroSeconds(); #endif /* helpers_hpp */