Skip to content

Commit

Permalink
ref: Fix some warnings. (#2054)
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev authored Sep 27, 2023
1 parent f5f3991 commit c706fa9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
16 changes: 4 additions & 12 deletions jvb/src/main/java/org/jitsi/videobridge/Conference.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class Conference
/**
* A map of the endpoints in this conference, by their ssrcs.
*/
private ConcurrentHashMap<Long, AbstractEndpoint> endpointsBySsrc = new ConcurrentHashMap<>();
private final ConcurrentHashMap<Long, AbstractEndpoint> endpointsBySsrc = new ConcurrentHashMap<>();

/**
* The relays participating in this conference.
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -1199,7 +1192,6 @@ public boolean hasRelays()

/**
* Handles an RTP/RTCP packet coming from a specific endpoint.
* @param packetInfo
*/
public void handleIncomingPacket(PacketInfo packetInfo)
{
Expand Down
9 changes: 4 additions & 5 deletions jvb/src/main/kotlin/org/jitsi/videobridge/Endpoint.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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,
Expand All @@ -235,7 +234,7 @@ class Endpoint @JvmOverloads constructor(
*/
override val messageTransport = EndpointMessageTransport(
this,
Supplier { conference.videobridge.statistics },
{ conference.videobridge.statistics },
conference,
logger
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions jvb/src/main/kotlin/org/jitsi/videobridge/SsrcCache.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit c706fa9

Please sign in to comment.