conferenceInfo: add info about active call

also remove "local" and update info when passing from a conference to a call

Change-Id: Iaf36623af053d7a723012b76dd7a2498ac7e9ec9
parent 9a5cb34f
......@@ -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
}
......
......@@ -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)},
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment