Skip to content

Commit

Permalink
conference: improve conference protocol for multi stream
Browse files Browse the repository at this point in the history
The current design got some limitations. It's not possible to
control informations per shared media. This means that we can't
got several active sinks for example.
The goal of this patch here is to update the conferences orders
to be able to control the state of each sink individually and for
the client to be able to handle conferences with accounts connected
via several devices with several medias per devices.
So each orders is sent with a different level (account/device/media)

For example, we will be able to send a moderator order for an account,
to hangup a device or to set a media active.

To support those orders, both sides MUST be patched. Else, the old
protocol will be used. The version of the protocol supported is sent
in the conferences informations to notify the peer what version to use.

Finally, this patch changes some APIs to support multisteam:
+ Some APIs now takes the deviceId or the sinkId when necessary

https://git.jami.net/savoirfairelinux/jami-project/-/issues/1429
Doc: https://git.jami.net/savoirfairelinux/jami-project/-/wikis/technical/6.1.-Conference-Protocol
Change-Id: Ieedd6055fd43b2a09b2cc8b253dcd6a3bf260a39
  • Loading branch information
Sébastien Blin committed Jun 17, 2022
1 parent e7243ce commit ea2e2e4
Show file tree
Hide file tree
Showing 23 changed files with 1,138 additions and 355 deletions.
30 changes: 30 additions & 0 deletions bin/dbus/cx.ring.Ring.CallManager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@
<arg type="s" name="callId" direction="in"/>
</method>

<method name="setActiveStream" tp:name-for-bindings="setActiveStream">
<tp:added version="13.1.0"/>
<arg type="s" name="accountId" direction="in" />
<arg type="s" name="confId" direction="in"/>
<arg type="s" name="accountUri" direction="in"/>
<arg type="s" name="deviceId" direction="in"/>
<arg type="s" name="streamId" direction="in"/>
<arg type="b" name="state" direction="in"/>
</method>

<method name="setModerator" tp:name-for-bindings="setModerator">
<tp:added version="11.0.0"/>
<arg type="s" name="accountId" direction="in" />
Expand All @@ -350,6 +360,16 @@
<arg type="b" name="state" direction="in"/>
</method>

<method name="muteStream" tp:name-for-bindings="muteStream">
<tp:added version="13.1.0"/>
<arg type="s" name="accountId" direction="in" />
<arg type="s" name="confId" direction="in"/>
<arg type="s" name="accountUri" direction="in"/>
<arg type="s" name="deviceId" direction="in"/>
<arg type="s" name="streamId" direction="in"/>
<arg type="b" name="state" direction="in"/>
</method>

<method name="isConferenceParticipant" tp:name-for-bindings="isConferenceParticipant">
<tp:added version="11.0.0"/>
<arg type="s" name="accountId" direction="in"/>
Expand All @@ -365,11 +385,21 @@
<arg type="b" name="state" direction="in"/>
</method>

<method name="raiseHand" tp:name-for-bindings="raiseHand">
<tp:added version="13.1.0"/>
<arg type="s" name="accountId" direction="in" />
<arg type="s" name="confId" direction="in"/>
<arg type="s" name="accountUri" direction="in"/>
<arg type="s" name="deviceId" direction="in"/>
<arg type="b" name="state" direction="in"/>
</method>

<method name="hangupParticipant" tp:name-for-bindings="hangupParticipant">
<tp:added version="11.0.0"/>
<arg type="s" name="accountId" direction="in" />
<arg type="s" name="confId" direction="in"/>
<arg type="s" name="peerId" direction="in"/>
<arg type="s" name="deviceId" direction="in"/>
</method>

<method name="addParticipant" tp:name-for-bindings="addParticipant">
Expand Down
37 changes: 35 additions & 2 deletions bin/dbus/dbuscallmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,38 @@ DBusCallManager::setActiveParticipant(const std::string& accountId,
DRing::setActiveParticipant(accountId, confId, callId);
}

void
DBusCallManager::muteStream(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const std::string& streamId,
const bool& state)
{
DRing::muteStream(accountId, confId, accountUri, deviceId, streamId, state);
}

void
DBusCallManager::setActiveStream(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const std::string& streamId,
const bool& state)
{
DRing::setActiveStream(accountId, confId, accountUri, deviceId, streamId, state);
}

void
DBusCallManager::raiseHand(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const bool& state)
{
DRing::raiseHand(accountId, confId, accountUri, deviceId, state);
}

auto
DBusCallManager::isConferenceParticipant(const std::string& accountId, const std::string& call_id)
-> decltype(DRing::isConferenceParticipant(accountId, call_id))
Expand Down Expand Up @@ -388,9 +420,10 @@ DBusCallManager::muteParticipant(const std::string& accountId,
void
DBusCallManager::hangupParticipant(const std::string& accountId,
const std::string& confId,
const std::string& peerId)
const std::string& peerId,
const std::string& deviceId)
{
DRing::hangupParticipant(accountId, confId, peerId);
DRing::hangupParticipant(accountId, confId, peerId, deviceId);
}

void
Expand Down
25 changes: 22 additions & 3 deletions bin/dbus/dbuscallmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,32 @@ class DRING_PUBLIC DBusCallManager : public cx::ring::Ring::CallManager_adaptor,
const std::string& confId,
const std::string& peerId,
const bool& state);
void muteParticipant(const std::string& accountId,
void muteStream(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const std::string& streamId,
const bool& state);
void setActiveStream(const std::string& accountId,
const std::string& confId,
const std::string& peerId,
const std::string& accountUri,
const std::string& deviceId,
const std::string& streamId,
const bool& state);
void raiseHand(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const bool& state);
void hangupParticipant(const std::string& accountId,
const std::string& confId,
const std::string& peerId);
const std::string& peerId,
const std::string& deviceId);
// DEPRECATED
void muteParticipant(const std::string& accountId,
const std::string& confId,
const std::string& peerId,
const bool& state);
void raiseParticipantHand(const std::string& accountId,
const std::string& confId,
const std::string& peerId,
Expand Down
23 changes: 22 additions & 1 deletion bin/jni/callmanager.i
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,29 @@ std::string getConferenceId(const std::string& accountId, const std::string& cal
std::map<std::string, std::string> getConferenceDetails(const std::string& accountId, const std::string& callId);
std::vector<std::map<std::string, std::string>> getConferenceInfos(const std::string& accountId, const std::string& confId);
void setModerator(const std::string& accountId, const std::string& confId, const std::string& peerId, const bool& state);
void muteStream(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const std::string& streamId,
const bool& state);
void setActiveStream(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const std::string& streamId,
const bool& state);
void hangupParticipant(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId);
void raiseHand(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const bool& state);
// DEPRECATED
void muteParticipant(const std::string& accountId, const std::string& confId, const std::string& peerId, const bool& state);
void hangupParticipant(const std::string& accountId, const std::string& confId, const std::string& peerId);
void raiseParticipantHand(const std::string& accountId, const std::string& confId, const std::string& peerId, const bool& state);

/* File Playback methods */
Expand Down
23 changes: 22 additions & 1 deletion bin/nodejs/callmanager.i
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,29 @@ std::string getConferenceId(const std::string& accountId, const std::string& cal
std::map<std::string, std::string> getConferenceDetails(const std::string& accountId, const std::string& callId);
std::vector<std::map<std::string, std::string>> getConferenceInfos(const std::string& accountId, const std::string& confId);
void setModerator(const std::string& accountId, const std::string& confId, const std::string& peerId, const bool& state);
void muteStream(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const std::string& streamId,
const bool& state);
void setActiveStream(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const std::string& streamId,
const bool& state);
void hangupParticipant(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId);
void raiseHand(const std::string& accountId,
const std::string& confId,
const std::string& accountUri,
const std::string& deviceId,
const bool& state);
// DEPRECATED
void muteParticipant(const std::string& accountId, const std::string& confId, const std::string& peerId, const bool& state);
void hangupParticipant(const std::string& accountId, const std::string& confId, const std::string& peerId);
void raiseParticipantHand(const std::string& accountId, const std::string& confId, const std::string& peerId, const bool& state);

/* File Playback methods */
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl Jami - configure.ac

dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([Jami Daemon],[13.0.0],[jami@gnu.org],[jami])
AC_INIT([Jami Daemon],[13.1.0],[jami@gnu.org],[jami])

dnl Clear the implicit flags that default to '-g -O2', otherwise they
dnl take precedence over the values we set via the
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('jami-daemon', ['c', 'cpp'],
version: '13.0.0',
version: '13.1.0',
license: 'GPL3+',
default_options: ['cpp_std=gnu++17', 'buildtype=debugoptimized'],
meson_version:'>= 0.56'
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ list (APPEND Source_Files
"${CMAKE_CURRENT_SOURCE_DIR}/compiler_intrinsics.h"
"${CMAKE_CURRENT_SOURCE_DIR}/conference.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/conference.h"
"${CMAKE_CURRENT_SOURCE_DIR}/conference_protocol.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/conference_protocol.h"
"${CMAKE_CURRENT_SOURCE_DIR}/data_transfer.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/data_transfer.h"
"${CMAKE_CURRENT_SOURCE_DIR}/enumclass_utils.h"
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ endif
libring_la_SOURCES = \
buildinfo.cpp \
conference.cpp \
conference_protocol.cpp \
account_factory.cpp \
call_factory.cpp \
preferences.cpp \
Expand All @@ -93,6 +94,7 @@ libring_la_SOURCES = \
ice_transport.h \
threadloop.h \
conference.h \
conference_protocol.h \
account_factory.h \
call_factory.h \
preferences.h \
Expand Down
4 changes: 4 additions & 0 deletions src/call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,10 @@ Call::setConferenceInfo(const std::string& msg)
newInfo.emplace_back(pInfo);
}
}
if (json.isMember("v")) {
newInfo.v = json["v"].asInt();
peerConfProtocol_ = newInfo.v;
}
if (json.isMember("w"))
newInfo.w = json["w"].asInt();
if (json.isMember("h"))
Expand Down
5 changes: 5 additions & 0 deletions src/call.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ class Call : public Recordable, public PeerRecorder, public std::enable_shared_f

virtual void monitor() const = 0;

int conferenceProtocolVersion() const { return peerConfProtocol_; }

protected:
using clock = std::chrono::steady_clock;
using time_point = clock::time_point;
Expand Down Expand Up @@ -516,6 +518,9 @@ class Call : public Recordable, public PeerRecorder, public std::enable_shared_f

///< MultiDevice: message received by subcall to merged yet
MsgList pendingInMessages_;

/// Supported conference protocol version
int peerConfProtocol_ {0};
};

// Helpers
Expand Down
Loading

0 comments on commit ea2e2e4

Please sign in to comment.