From f35992be696a3d6f6f0f233d9813e39ec69e40dd Mon Sep 17 00:00:00 2001
From: Pierre Lespagnol <pierre.lespagnol@savoirfairelinux.com>
Date: Thu, 4 Mar 2021 12:51:43 -0500
Subject: [PATCH] conference: allow to receive the new confInfo

Gitlab: #468

Change-Id: I2c94823bb8efab6fccddd59de1ae96f290745691
---
 src/call.cpp     | 30 ++++++++++++++++++++++++------
 src/conference.h |  2 ++
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/src/call.cpp b/src/call.cpp
index 9c12952c31..c036d56c7c 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -643,12 +643,30 @@ Call::setConferenceInfo(const std::string& msg)
     Json::CharReaderBuilder rbuilder;
     auto reader = std::unique_ptr<Json::CharReader>(rbuilder.newCharReader());
     if (reader->parse(msg.data(), msg.data() + msg.size(), &json, &err)) {
-        for (const auto& participantInfo : json) {
-            ParticipantInfo pInfo;
-            if (!participantInfo.isMember("uri"))
-                continue;
-            pInfo.fromJson(participantInfo);
-            newInfo.emplace_back(pInfo);
+        if (json.isObject()) {
+            // new confInfo
+            if (json.isMember("p")) {
+                for (const auto& participantInfo : json["p"]) {
+                    ParticipantInfo pInfo;
+                    if (!participantInfo.isMember("uri"))
+                        continue;
+                    pInfo.fromJson(participantInfo);
+                    newInfo.emplace_back(pInfo);
+                }
+            }
+            if (json.isMember("w"))
+                newInfo.w = json["w"].asInt();
+            if (json.isMember("h"))
+                newInfo.h = json["h"].asInt();
+        } else {
+            // old confInfo
+            for (const auto& participantInfo : json) {
+                ParticipantInfo pInfo;
+                if (!participantInfo.isMember("uri"))
+                    continue;
+                pInfo.fromJson(participantInfo);
+                newInfo.emplace_back(pInfo);
+            }
         }
     }
 
diff --git a/src/conference.h b/src/conference.h
index 1f84e3e418..61aaefcede 100644
--- a/src/conference.h
+++ b/src/conference.h
@@ -111,6 +111,8 @@ struct ParticipantInfo
 struct ConfInfo : public std::vector<ParticipantInfo>
 {
     std::vector<std::map<std::string, std::string>> toVectorMapStringString() const;
+    int h {0};
+    int w {0};
 };
 
 using ParticipantSet = std::set<std::string>;
-- 
GitLab