81 uri = v[
"uri"].asString();
82 device = v[
"device"].asString();
83 sinkId = v[
"sinkId"].asString();
84 active = v[
"active"].asBool();
119 std::map<std::string, std::string>
toMap()
const
121 return {{
"uri",
uri},
124 {
"active",
active ?
"true" :
"false"},
125 {
"x", std::to_string(
x)},
126 {
"y", std::to_string(
y)},
127 {
"w", std::to_string(
w)},
128 {
"h", std::to_string(
h)},
129 {
"videoMuted",
videoMuted ?
"true" :
"false"},
133 {
"handRaised",
handRaised ?
"true" :
"false"},
135 {
"recording",
recording ?
"true" :
"false"}};
142 and p1.audioLocalMuted ==
p2.audioLocalMuted
and p1.audioModeratorMuted ==
p2.audioModeratorMuted
143 and p1.isModerator ==
p2.isModerator
and p1.handRaised ==
p2.handRaised
144 and p1.voiceActivity ==
p2.voiceActivity
and p1.recording ==
p2.recording;
150struct ConfInfo :
public std::vector<ParticipantInfo>
161 if (
c1.size() !=
c2.size())
164 for (
auto&
p1 :
c1) {
181using clock = std::chrono::steady_clock;
191 explicit Conference(
const std::shared_ptr<Account>&,
const std::string&
confId =
"");
203 std::shared_ptr<Account>
getAccount()
const {
return account_.lock(); }
229 return "ACTIVE_ATTACHED";
231 return "ACTIVE_DETACHED";
304 void onConfOrder(
const std::string& callId,
const std::string& order);
310 std::shared_ptr<video::VideoMixer> getVideoMixer();
316 std::lock_guard
lk(confInfoMutex_);
321 void setModerator(
const std::string& uri,
const bool& state);
323 void setHandRaised(
const std::string& uri,
const bool& state);
341 const std::string& deviceId,
342 const std::string& streamId,
377 return duration_start_ == clock::time_point::min()
378 ? std::chrono::milliseconds::zero()
379 : std::chrono::duration_cast<std::chrono::milliseconds>(clock::now() - duration_start_);
383 std::weak_ptr<Conference> weak() {
return std::static_pointer_cast<Conference>(
shared_from_this()); }
385 static std::shared_ptr<Call> getCall(
const std::string& callId);
386 bool isModerator(std::string_view uri)
const;
387 bool isHandRaised(std::string_view uri)
const;
388 bool isVoiceActive(std::string_view uri)
const;
389 void updateModerators();
390 void updateHandsRaised();
391 void muteHost(
bool state);
392 void muteCall(
const std::string& callId,
bool state);
394 void foreachCall(
const std::function<
void(
const std::shared_ptr<Call>& call)>&
cb);
397 std::weak_ptr<Account> account_;
399 mutable std::mutex subcallsMtx_ {};
401 std::string mediaPlayerId_ {};
403 mutable std::mutex confInfoMutex_ {};
404 ConfInfo confInfo_ {};
406 void sendConferenceInfos();
407 std::shared_ptr<RingBuffer> ghostRingBuffer_;
411 std::shared_ptr<video::VideoMixer> videoMixer_;
412 std::map<std::string, std::shared_ptr<video::SinkClient>>
confSinksMap_ {};
415 std::shared_ptr<jami::AudioInput> audioMixer_;
416 std::set<std::string, std::less<>> moderators_ {};
417 std::set<std::string, std::less<>> participantsMuted_ {};
418 std::set<std::string, std::less<>> handsRaised_;
421 std::set<std::string, std::less<>> streamsVoiceActive {};
423 void initRecorder(std::shared_ptr<MediaRecorder>&
rec);
424 void deinitRecorder(std::shared_ptr<MediaRecorder>&
rec);
426 bool isMuted(std::string_view uri)
const;
429 bool isHost(std::string_view uri)
const;
430 bool isHostDevice(std::string_view deviceId)
const;
437 std::vector<MediaAttribute> hostSources_;
439 std::map<std::string, std::shared_ptr<jami::AudioInput>> hostAudioInputs_;
442 std::vector<libjami::MediaMap> lastMediaList_ = {};
444 bool localModAdded_ {
false};
446 std::map<std::string, ConfInfo> remoteHosts_;
450 std::string_view findHostforRemoteParticipant(std::string_view uri, std::string_view deviceId =
"");
452 std::shared_ptr<Call> getCallWith(
const std::string&
accountUri,
const std::string& deviceId);
454 std::mutex sinksMtx_ {};
468 [](
const std::shared_ptr<jami::MediaFrame>&
m) ->
AVFrame* {
469 return std::static_pointer_cast<VideoFrame>(
m)->pointer();
491 std::map<std::string, std::shared_ptr<MediaStreamSubject>>
confAVStreams;
494 ConfProtocolParser parser_;
495 std::string getRemoteId(
const std::shared_ptr<jami::Call>& call)
const;
497 std::function<
void(
int)> shutdownCb_;
498 clock::time_point duration_start_;
503 void initSourcesForHost();
533 const std::shared_ptr<JamiAccount>& acc,
541 void registerProtocolHandlers();
549 void takeOverMediaSourceControl(
const std::string& callId);
554 void bindHostAudio();
559 void unbindHostAudio();
564 void bindSubCallAudio(
const std::string& callId);
569 void unbindSubCallAudio(
const std::string& callId);
574 void clearParticipantData(
const std::string& callId);
const char * getStateStr() const
std::vector< libjami::MediaMap > getLastMediaList() const
Return the last media list before the host was detached.
void setVoiceActivity(const std::string &streamId, const bool &newState)
std::string getAccountId() const
bool isVideoEnabled() const
void hangupParticipant(const std::string &accountUri, const std::string &deviceId="")
void muteLocalHost(bool is_muted, const std::string &mediaType)
std::chrono::milliseconds getDuration() const
bool startRecording(const std::string &path) override
Start recording.
const std::string & getConfId() const
Return the conference id.
void removeSubCall(const std::string &callId)
Remove a subcall from the conference.
void updateVoiceActivity()
std::vector< libjami::MediaMap > currentMediaList() const
Retrieve current medias list.
std::vector< std::map< std::string, std::string > > getConferenceInfos() const
void detachHost()
Detach local audio/video from the conference.
~Conference()
Destructor for this class, decrement static counter.
void mergeConfInfo(ConfInfo &newInfo, const std::string &peerURI)
void setActiveParticipant(const std::string &participant_id)
void handleMediaChangeRequest(const std::shared_ptr< Call > &call, const std::vector< libjami::MediaMap > &remoteMediaList)
Process incoming media change request.
void setLocalHostMuteState(MediaType type, bool muted)
Set the mute state of the local host.
void setState(State state)
Set conference state.
bool requestMediaChange(const std::vector< libjami::MediaMap > &mediaList)
Process a media change request.
void onConfOrder(const std::string &callId, const std::string &order)
void addSubCall(const std::string &callId)
Add a new subcall to the conference.
std::shared_ptr< Account > getAccount() const
void onShutdown(std::function< void(int)> cb)
Set a callback that will be called when the conference will be destroyed.
std::shared_ptr< Call > getCallFromPeerID(std::string_view peerId)
void setActiveStream(const std::string &streamId, bool state)
void setModerator(const std::string &uri, const bool &state)
static constexpr const char * getStateStr(State state)
Return a string description of the conference state.
void stopRecording() override
Stop recording.
bool toggleRecording() override
Start/stop recording toggle.
CallIdSet getSubCalls() const
Get the participant list for this conference.
void setHandRaised(const std::string &uri, const bool &state)
void attachHost(const std::vector< libjami::MediaMap > &mediaList)
Attach host.
void muteParticipant(const std::string &uri, const bool &state)
State getState() const
Return the current conference state.
void muteStream(const std::string &accountUri, const std::string &deviceId, const std::string &streamId, const bool &state)
The client shows one tile per stream (video/audio related to a media)
void updateConferenceInfo(ConfInfo confInfo)
void switchInput(const std::string &input)
bool isRemoteParticipant(const std::string &uri)
void setLayout(int layout)
void reportMediaNegotiationStatus()
Announce to the client that medias are successfully negotiated.
bool isMediaSourceMuted(MediaType type) const
Get the mute state of the local host.
std::set< std::string > CallIdSet
void emitSignal(Args... args)
std::chrono::steady_clock clock
Contains information about an AV subject.
std::string toString() const
std::vector< std::map< std::string, std::string > > toVectorMapStringString() const
friend bool operator!=(const ConfInfo &c1, const ConfInfo &c2)
friend bool operator==(const ConfInfo &c1, const ConfInfo &c2)
Json::Value toJson() const
friend bool operator==(const ParticipantInfo &p1, const ParticipantInfo &p2)
std::map< std::string, std::string > toMap() const
friend bool operator!=(const ParticipantInfo &p1, const ParticipantInfo &p2)
void fromJson(const Json::Value &v)