diff --git a/jvb/src/main/java/org/jitsi/videobridge/Conference.java b/jvb/src/main/java/org/jitsi/videobridge/Conference.java index 7b2bc5d0aa..3eb24e83a6 100644 --- a/jvb/src/main/java/org/jitsi/videobridge/Conference.java +++ b/jvb/src/main/java/org/jitsi/videobridge/Conference.java @@ -84,7 +84,7 @@ public class Conference /** * A map of the endpoints in this conference, by their ssrcs. */ - private ConcurrentHashMap endpointsBySsrc = new ConcurrentHashMap<>(); + private final ConcurrentHashMap endpointsBySsrc = new ConcurrentHashMap<>(); /** * The relays participating in this conference. @@ -643,11 +643,9 @@ private void updateStatisticsOnExpire() if (logger.isInfoEnabled()) { - StringBuilder sb = new StringBuilder("expire_conf,"); - sb.append("duration=").append(durationSeconds) - .append(",has_failed=").append(hasFailed) - .append(",has_partially_failed=").append(hasPartiallyFailed); - logger.info(sb.toString()); + logger.info("expire_conf,duration=" + durationSeconds + + ",has_failed=" + hasFailed + + ",has_partially_failed=" + hasPartiallyFailed); } } @@ -1083,11 +1081,6 @@ public void addEndpointSsrc(@NotNull AbstractEndpoint endpoint, long ssrc) } } - public void removeEndpointSsrc(@NotNull AbstractEndpoint endpoint, long ssrc) - { - endpointsBySsrc.remove(ssrc, endpoint); - } - /** * Gets the conference name. * @@ -1199,7 +1192,6 @@ public boolean hasRelays() /** * Handles an RTP/RTCP packet coming from a specific endpoint. - * @param packetInfo */ public void handleIncomingPacket(PacketInfo packetInfo) { diff --git a/jvb/src/main/kotlin/org/jitsi/videobridge/Endpoint.kt b/jvb/src/main/kotlin/org/jitsi/videobridge/Endpoint.kt index f04ead42b7..f8eaf607f4 100644 --- a/jvb/src/main/kotlin/org/jitsi/videobridge/Endpoint.kt +++ b/jvb/src/main/kotlin/org/jitsi/videobridge/Endpoint.kt @@ -93,7 +93,6 @@ import java.time.Instant import java.util.Optional import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicLong -import java.util.function.Supplier /** * Models a local endpoint (participant) in a [Conference] @@ -220,7 +219,7 @@ class Endpoint @JvmOverloads constructor( override fun keyframeNeeded(endpointId: String?, ssrc: Long) = conference.requestKeyframe(endpointId, ssrc) }, - Supplier { getOrderedEndpoints() }, + { getOrderedEndpoints() }, diagnosticContext, logger, isUsingSourceNames, @@ -235,7 +234,7 @@ class Endpoint @JvmOverloads constructor( */ override val messageTransport = EndpointMessageTransport( this, - Supplier { conference.videobridge.statistics }, + { conference.videobridge.statistics }, conference, logger ) @@ -288,7 +287,7 @@ class Endpoint @JvmOverloads constructor( return transceiver.sendProbing(mediaSsrcs, numBytes) } }, - Supplier { bitrateController.getStatusSnapshot() } + { bitrateController.getStatusSnapshot() } ).apply { diagnosticsContext = this@Endpoint.diagnosticContext enabled = true @@ -559,7 +558,7 @@ class Endpoint @JvmOverloads constructor( if (doSsrcRewriting) { val newActiveSources = newEffectiveConstraints.entries.filter { !it.value.isDisabled() }.map { it.key }.toList() - val newActiveSourceNames = newActiveSources.mapNotNull { it.sourceName }.toSet() + val newActiveSourceNames = newActiveSources.map { it.sourceName }.toSet() /* safe unlocked access of activeSources. BitrateController will not overlap calls to this method. */ if (activeSources != newActiveSourceNames) { activeSources = newActiveSourceNames diff --git a/jvb/src/main/kotlin/org/jitsi/videobridge/SsrcCache.kt b/jvb/src/main/kotlin/org/jitsi/videobridge/SsrcCache.kt index 15e59d85af..297693bc0f 100644 --- a/jvb/src/main/kotlin/org/jitsi/videobridge/SsrcCache.kt +++ b/jvb/src/main/kotlin/org/jitsi/videobridge/SsrcCache.kt @@ -448,7 +448,7 @@ abstract class SsrcCache(val size: Int, val ep: SsrcRewriter, val parentLogger: synchronized(sendSources) { /* Don't activate a source on RTCP. */ - var rs = receivedSsrcs.get(packet.senderSsrc) ?: return false + val rs = receivedSsrcs.get(packet.senderSsrc) ?: return false val ss = getSendSource(rs.props.ssrc1, rs.props, allowCreate = false, remappings) ?: return false ss.rewriteRtcp(packet) logger.debug { @@ -537,10 +537,10 @@ class AudioSsrcCache(size: Int, ep: SsrcRewriter, parentLogger: Logger) : */ override fun findSourceProps(ssrc: Long): SourceDesc? { val p = ep.findAudioSourceProps(ssrc) - if (p == null || p.sourceName == null || p.owner == null) { - return null + return if (p?.sourceName == null || p.owner == null) { + null } else { - return SourceDesc(p) + SourceDesc(p) } }