Skip to content

Commit a640057

Browse files
authored
Remove colibri1 (#898)
* Remove colibri v1 classes. * ref: Remove ColibriConfig. * Remove injected SSRCs and leftovers. * Remove GID. * Remove rtpDescriptions from colibri API. * Remove redundant API call. * Clean up the colibri API a bit. * ref: Remove the reInvite flag from colibri.
1 parent 2691ed9 commit a640057

31 files changed

+76
-3573
lines changed

src/main/java/org/jitsi/jicofo/FocusManager.java

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ public class FocusManager
4949
*/
5050
private final static Logger logger = new LoggerImpl(FocusManager.class.getName());
5151

52-
/**
53-
* The pseudo-random generator which is to be used when generating IDs.
54-
*/
55-
private static final Random RANDOM = new Random();
56-
5752
/**
5853
* The thread that expires {@link JitsiMeetConference}s.
5954
*/
@@ -75,13 +70,7 @@ public class FocusManager
7570
private final List<JitsiMeetConference> conferencesCache = new CopyOnWriteArrayList<>();
7671

7772
/**
78-
* The set of the IDs of conferences in {@link #conferences}.
79-
*/
80-
private final Set<Long> conferenceGids = new HashSet<>();
81-
82-
/**
83-
* The object used to synchronize access to {@link #conferences} and
84-
* {@link #conferenceGids}.
73+
* The object used to synchronize access to {@link #conferences}.
8574
*/
8675
private final Object conferencesSyncRoot = new Object();
8776

@@ -97,12 +86,6 @@ public class FocusManager
9786
*/
9887
private final Statistics statistics = new Statistics();
9988

100-
/**
101-
* The ID of this Jicofo instance, used to generate conference GIDs. The special value 0 is valid in the Octo
102-
* protocol, but only used when no value is explicitly configured.
103-
*/
104-
private int octoId;
105-
10689
/**
10790
* Clock to use for pin timeouts.
10891
*/
@@ -130,26 +113,6 @@ public FocusManager()
130113
public void start()
131114
{
132115
expireThread.start();
133-
134-
int octoId = 0;
135-
Integer configuredId = OctoConfig.config.getId();
136-
if (configuredId != null)
137-
{
138-
octoId = configuredId;
139-
}
140-
if (octoId < 1 || octoId > 0xffff)
141-
{
142-
logger.warn(
143-
"Jicofo ID is not set correctly set (value=" + octoId + "). Configure a valid value [1-65535] by "
144-
+ "setting org.jitsi.jicofo.SHORT_ID in sip-communicator.properties or jicofo.octo.id in jicofo.conf. "
145-
+ "Future versions will require this for Octo.");
146-
this.octoId = 0;
147-
}
148-
else
149-
{
150-
logger.info("Initialized octoId=" + octoId);
151-
this.octoId = octoId;
152-
}
153116
}
154117

155118
/**
@@ -286,17 +249,15 @@ private JitsiMeetConferenceImpl createConference(
286249
JitsiMeetConferenceImpl conference;
287250
synchronized (conferencesSyncRoot)
288251
{
289-
long id = generateConferenceId();
290252
String jvbVersion = getBridgeVersionForConference(room);
291253
conference
292254
= new JitsiMeetConferenceImpl(
293255
room,
294256
this, config, logLevel,
295-
id, jvbVersion, includeInStatistics);
257+
jvbVersion, includeInStatistics);
296258

297259
conferences.put(room, conference);
298260
conferencesCache.add(conference);
299-
conferenceGids.add(id);
300261
}
301262

302263
if (includeInStatistics)
@@ -307,27 +268,6 @@ private JitsiMeetConferenceImpl createConference(
307268
return conference;
308269
}
309270

310-
/**
311-
* Generates a conference ID which is currently not used by an existing
312-
* conference in a specific format (6 hexadecimal symbols).
313-
* @return the generated ID.
314-
*/
315-
private long generateConferenceId()
316-
{
317-
long id;
318-
319-
synchronized (conferencesSyncRoot)
320-
{
321-
do
322-
{
323-
id = (octoId << 16) | RANDOM.nextInt(0x1_0000);
324-
}
325-
while (conferenceGids.contains(id));
326-
}
327-
328-
return id;
329-
}
330-
331271
/**
332272
* Destroys the conference for given room name.
333273
* @param roomName full MUC room name to destroy.
@@ -365,7 +305,6 @@ public void conferenceEnded(JitsiMeetConferenceImpl conference)
365305
{
366306
conferences.remove(roomName);
367307
conferencesCache.remove(conference);
368-
conferenceGids.remove(conference.getId());
369308

370309
// It is not clear whether the code below necessarily needs to
371310
// hold the lock or not.
@@ -554,11 +493,6 @@ public JSONObject getStats()
554493
return statistics;
555494
}
556495

557-
public boolean isJicofoIdConfigured()
558-
{
559-
return octoId != 0;
560-
}
561-
562496
@NotNull
563497
OrderedJsonObject getDebugState(boolean full)
564498
{

src/main/java/org/jitsi/jicofo/conference/JitsiMeetConferenceImpl.java

Lines changed: 21 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.jitsi.jicofo.auth.*;
2424
import org.jitsi.jicofo.bridge.*;
2525
import org.jitsi.jicofo.conference.colibri.*;
26-
import org.jitsi.jicofo.conference.colibri.v1.*;
2726
import org.jitsi.jicofo.conference.colibri.v2.*;
2827
import org.jitsi.jicofo.conference.source.*;
2928
import org.jitsi.jicofo.lipsynchack.*;
@@ -218,8 +217,6 @@ public class JitsiMeetConferenceImpl
218217
*/
219218
private boolean videoLimitReached = false;
220219

221-
private final long gid;
222-
223220
/**
224221
* Requested bridge version from a pin. null if not pinned.
225222
*/
@@ -245,7 +242,6 @@ public JitsiMeetConferenceImpl(
245242
ConferenceListener listener,
246243
@NotNull JitsiMeetConfig config,
247244
Level logLevel,
248-
long gid,
249245
String jvbVersion,
250246
boolean includeInStatistics)
251247
{
@@ -260,21 +256,12 @@ public JitsiMeetConferenceImpl(
260256
this.includeInStatistics = includeInStatistics;
261257

262258
this.jicofoServices = Objects.requireNonNull(JicofoServices.jicofoServicesSingleton);
263-
this.gid = gid;
264259
this.jvbVersion = jvbVersion;
265-
if (ColibriConfig.config.getEnableColibri2())
266-
{
267-
colibriSessionManager = new ColibriV2SessionManager(
268-
jicofoServices.getXmppServices().getServiceConnection().getXmppConnection(),
269-
jicofoServices.getBridgeSelector(),
270-
this,
271-
logger);
272-
}
273-
else
274-
{
275-
colibriSessionManager
276-
= new ColibriV1SessionManager(jicofoServices, gid, this, colibriRequestCallback, logger);
277-
}
260+
colibriSessionManager = new ColibriV2SessionManager(
261+
jicofoServices.getXmppServices().getServiceConnection().getXmppConnection(),
262+
jicofoServices.getBridgeSelector(),
263+
this,
264+
logger);
278265
colibriSessionManager.addListener(colibriSessionManagerListener);
279266

280267
logger.info("Created new conference.");
@@ -285,10 +272,9 @@ public JitsiMeetConferenceImpl(
285272
ConferenceListener listener,
286273
@NotNull JitsiMeetConfig config,
287274
Level logLevel,
288-
long gid,
289275
String jvbVersion)
290276
{
291-
this(roomName, listener, config, logLevel, gid, jvbVersion, false);
277+
this(roomName, listener, config, logLevel, jvbVersion, false);
292278
}
293279

294280
/**
@@ -1085,10 +1071,9 @@ public StanzaError onSessionTerminate(@NotNull JingleSession session, JingleIQ i
10851071
*/
10861072
private void propagateNewSources(Participant sourceOwner, ConferenceSourceMap sources)
10871073
{
1088-
final ConferenceSourceMap finalSources = sources
1089-
.copy()
1090-
.strip(ConferenceConfig.config.stripSimulcast(), true)
1091-
.unmodifiable();
1074+
final ConferenceSourceMap finalSources = (ConferenceConfig.config.stripSimulcast())
1075+
? sources.copy().stripSimulcast().unmodifiable()
1076+
: sources.copy().unmodifiable();
10921077
if (finalSources.isEmpty())
10931078
{
10941079
logger.debug("No new sources to propagate.");
@@ -1117,7 +1102,7 @@ public void onTransportInfo(@NotNull JingleSession session, List<ContentPacketEx
11171102
return;
11181103
}
11191104

1120-
colibriSessionManager.updateParticipant(participant, getTransport(contentList), null, null);
1105+
colibriSessionManager.updateParticipant(participant, getTransport(contentList), null);
11211106
}
11221107

11231108
/**
@@ -1220,7 +1205,7 @@ public StanzaError onAddSource(@NotNull JingleSession jingleSession, List<Conten
12201205
// Updates source groups on the bridge
12211206
// We may miss the notification, but the state will be synced up
12221207
// after conference has been relocated to the new bridge
1223-
colibriSessionManager.addSources(participant, sourcesAccepted);
1208+
colibriSessionManager.updateParticipant(participant, null, participant.getSources());
12241209

12251210
propagateNewSources(participant, sourcesAccepted);
12261211

@@ -1284,18 +1269,6 @@ private StanzaError onSessionAcceptInternal(
12841269
{
12851270
logger.debug("Received initial sources from " + participantId + ": " + sourcesAdvertised);
12861271
}
1287-
if (sourcesAdvertised.isEmpty() && ConferenceConfig.config.injectSsrcForRecvOnlyEndpoints()
1288-
&& !(ColibriConfig.config.getEnableColibri2()))
1289-
{
1290-
// We inject an SSRC in order to ensure that the participant has
1291-
// at least one SSRC advertised. Otherwise, non-local bridges in the
1292-
// conference will not be aware of the participant.
1293-
// This is not necessary (and might trigger unexpected behavior) with colibri2.
1294-
long ssrc = RANDOM.nextInt() & 0xffff_ffffL;
1295-
logger.info(participant + " did not advertise any SSRCs. Injecting " + ssrc);
1296-
sourcesAdvertised = new EndpointSourceSet(
1297-
new Source(ssrc, MediaType.AUDIO, participantId + "-injected0", null, true));
1298-
}
12991272
ConferenceSourceMap sourcesAccepted;
13001273
try
13011274
{
@@ -1315,8 +1288,7 @@ private StanzaError onSessionAcceptInternal(
13151288
colibriSessionManager.updateParticipant(
13161289
participant,
13171290
getTransport(contents),
1318-
sourcesAccepted,
1319-
getRtpDescriptions(contents));
1291+
sourcesAccepted);
13201292

13211293
// Propagate [participant]'s sources to the other participants.
13221294
propagateNewSources(participant, sourcesAccepted);
@@ -1326,26 +1298,6 @@ private StanzaError onSessionAcceptInternal(
13261298
return null;
13271299
}
13281300

1329-
/**
1330-
* Extract a map from content name to the first child of type {@link RtpDescriptionPacketExtension}.
1331-
*/
1332-
private Map<String, RtpDescriptionPacketExtension> getRtpDescriptions(
1333-
@NotNull List<ContentPacketExtension> contents)
1334-
{
1335-
Map<String, RtpDescriptionPacketExtension> rtpDescriptions = new HashMap<>();
1336-
for (ContentPacketExtension content : contents)
1337-
{
1338-
RtpDescriptionPacketExtension rtpDescription
1339-
= content.getFirstChildOfType(RtpDescriptionPacketExtension.class);
1340-
if (rtpDescription != null)
1341-
{
1342-
rtpDescriptions.put(content.getName(), rtpDescription);
1343-
}
1344-
}
1345-
1346-
return rtpDescriptions;
1347-
}
1348-
13491301
/**
13501302
* Find the first {@link IceUdpTransportPacketExtension} in a list of Jingle contents.
13511303
*/
@@ -1416,10 +1368,11 @@ private StanzaError removeSources(
14161368
return null;
14171369
}
14181370

1419-
colibriSessionManager.removeSources(
1371+
colibriSessionManager.updateParticipant(
14201372
participant,
1421-
sourcesAcceptedToBeRemoved,
1422-
removeColibriSourcesFromLocalBridge);
1373+
null,
1374+
participant.getSources(),
1375+
!removeColibriSourcesFromLocalBridge);
14231376

14241377
if (sendSourceRemove)
14251378
{
@@ -1436,10 +1389,9 @@ private StanzaError removeSources(
14361389
*/
14371390
private void sendSourceRemove(ConferenceSourceMap sources, Participant except)
14381391
{
1439-
final ConferenceSourceMap finalSources = sources
1440-
.copy()
1441-
.strip(ConferenceConfig.config.stripSimulcast(), true)
1442-
.unmodifiable();
1392+
final ConferenceSourceMap finalSources = ConferenceConfig.config.stripSimulcast()
1393+
? sources.copy().stripSimulcast().unmodifiable()
1394+
: sources.copy().unmodifiable();
14431395
if (finalSources.isEmpty())
14441396
{
14451397
logger.debug("No sources to remove.");
@@ -1616,8 +1568,6 @@ public OrderedJsonObject getDebugState()
16161568
o.put("conference_sources", conferenceSources.toJson());
16171569
o.put("audio_limit_reached", audioLimitReached);
16181570
o.put("video_limit_reached", videoLimitReached);
1619-
o.put("gid", gid);
1620-
16211571

16221572
return o;
16231573
}
@@ -1704,14 +1654,6 @@ public int getParticipantCount()
17041654
return participants.size();
17051655
}
17061656

1707-
/**
1708-
* Conference ID.
1709-
*/
1710-
public long getId()
1711-
{
1712-
return gid;
1713-
}
1714-
17151657
/**
17161658
* Get pinned bridge version. Returns null if not pinned.
17171659
*/
@@ -2104,9 +2046,9 @@ public void numVideoSendersChanged(int numVideoSenders)
21042046
}
21052047

21062048
/**
2107-
* Listener for events from {@link ColibriV1SessionManager}.
2049+
* Listener for events from {@link ColibriSessionManager}.
21082050
*/
2109-
private class ColibriSessionManagerListener implements ColibriV1SessionManager.Listener
2051+
private class ColibriSessionManagerListener implements ColibriSessionManager.Listener
21102052
{
21112053
@Override
21122054
public void bridgeCountChanged(int bridgeCount)

src/main/java/org/jitsi/jicofo/conference/ParticipantInviteRunnable.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private void doRun()
179179
ColibriAllocation colibriAllocation;
180180
try
181181
{
182-
colibriAllocation = colibriSessionManager.allocate(participant, offer.getContents(), reInvite);
182+
colibriAllocation = colibriSessionManager.allocate(participant, offer.getContents());
183183
}
184184
catch (BridgeSelectionFailedException e)
185185
{
@@ -357,10 +357,6 @@ else if (!canceled)
357357
// not trigger a retry here.
358358
meetConference.onInviteFailed(this);
359359
}
360-
else if (reInvite)
361-
{
362-
colibriSessionManager.updateParticipant(participant, null, null, null);
363-
}
364360

365361
// TODO: include force-mute in the initial allocation, instead of sending 2 additional colibri messages.
366362
if (chatRoom != null && !participant.hasModeratorRights())
@@ -456,7 +452,10 @@ private boolean doInviteOrReinvite(Jid address, Offer offer, ColibriAllocation c
456452
ConferenceSourceMap conferenceSources = meetConference.getSources().copy();
457453
// Add the bridge's feedback sources.
458454
conferenceSources.add(colibriAllocation.getSources());
459-
conferenceSources.strip(ConferenceConfig.config.stripSimulcast(), true);
455+
if (ConferenceConfig.config.stripSimulcast())
456+
{
457+
conferenceSources.stripSimulcast();
458+
}
460459
conferenceSources.stripByMediaType(participant.getSupportedMediaTypes());
461460
// Remove the participant's own sources (if they're present)
462461
conferenceSources.remove(participant.getMucJid());

0 commit comments

Comments
 (0)