diff --git a/src/conference.cpp b/src/conference.cpp index aaf4ad0b58b4fc4bb0b082c8b6f3877321269f06..d39837b9d39dc8bb0250915c4a0b6ee3289f0bc5 100644 --- a/src/conference.cpp +++ b/src/conference.cpp @@ -54,7 +54,7 @@ Conference::Conference() ConfInfo newInfo; std::unique_lock<std::mutex> lk(shared->videoToCallMtx_); for (const auto& info : infos) { - std::string uri = "local"; + std::string uri = ""; auto it = shared->videoToCall_.find(info.source); if (it == shared->videoToCall_.end()) it = shared->videoToCall_.emplace_hint(it, info.source, std::string()); @@ -69,8 +69,14 @@ Conference::Conference() uri = call->getPeerNumber(); } } + auto active = false; + if (auto videoMixer = shared->getVideoMixer()) + active = info.source == videoMixer->getActiveParticipant() + or (uri.empty() + and not videoMixer->getActiveParticipant()); // by default, local + // is shown as active newInfo.emplace_back( - ParticipantInfo {std::move(uri), info.x, info.y, info.w, info.h}); + ParticipantInfo {std::move(uri), active, info.x, info.y, info.w, info.h}); } lk.unlock(); @@ -89,8 +95,13 @@ Conference::~Conference() { #ifdef ENABLE_VIDEO for (const auto& participant_id : participants_) { - if (auto call = Manager::instance().callFactory.getCall<SIPCall>(participant_id)) + if (auto call = Manager::instance().callFactory.getCall<SIPCall>(participant_id)) { call->getVideoRtp().exitConference(); + // Reset distant callInfo + call->sendTextMessage(std::map<std::string, std::string> {{"application/confInfo+json", + "[]"}}, + call->getAccount().getFromUri()); + } } #endif // ENABLE_VIDEO } diff --git a/src/conference.h b/src/conference.h index dfbfcfd838a0ba1afd4675a10a86557b60f39f3a..78dd62a6934b253098ddff94e5780d006f813137 100644 --- a/src/conference.h +++ b/src/conference.h @@ -44,6 +44,7 @@ class VideoMixer; struct ParticipantInfo { std::string uri; + bool active {false}; int x {0}; int y {0}; int w {0}; @@ -52,6 +53,7 @@ struct ParticipantInfo void fromJson(const Json::Value& v) { uri = v["uri"].asString(); + active = v["active"].asBool(); x = v["x"].asInt(); y = v["y"].asInt(); w = v["w"].asInt(); @@ -62,6 +64,7 @@ struct ParticipantInfo { Json::Value val; val["uri"] = uri; + val["active"] = active; val["x"] = x; val["y"] = y; val["w"] = w; @@ -72,6 +75,7 @@ struct ParticipantInfo std::map<std::string, std::string> toMap() const { return {{"uri", uri}, + {"active", active ? "true" : "false"}, {"x", std::to_string(x)}, {"y", std::to_string(y)}, {"w", std::to_string(w)}, diff --git a/src/media/video/video_mixer.h b/src/media/video/video_mixer.h index fb67b7a8a92d34d16af2e721490554571492b08d..9710165db514ee2c8fd152b173c02cc4685a2765 100644 --- a/src/media/video/video_mixer.h +++ b/src/media/video/video_mixer.h @@ -71,6 +71,8 @@ public: void setActiveParticipant(Observable<std::shared_ptr<MediaFrame>>* ob); + Observable<std::shared_ptr<MediaFrame>>* getActiveParticipant() { return activeSource_; } + void setVideoLayout(Layout newLayout) { currentLayout_ = newLayout;