From d25b8821ac3ac74231e5839ec4c21a1bba217703 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Fri, 31 Aug 2018 14:34:33 -0500 Subject: [PATCH 1/8] fix: Adds a null check. --- .../org/jitsi/videobridge/RtpChannel.java | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/jitsi/videobridge/RtpChannel.java b/src/main/java/org/jitsi/videobridge/RtpChannel.java index 0c8011d336..58f8b5403c 100644 --- a/src/main/java/org/jitsi/videobridge/RtpChannel.java +++ b/src/main/java/org/jitsi/videobridge/RtpChannel.java @@ -1903,19 +1903,29 @@ private void updateStatisticsOnExpire() updatePacketsAndBytes(conferenceStatistics); - TrackStats streamStats - = stream.getMediaStreamStats().getSendStats(); - logger.info(Logger.Category.STATISTICS, - "expire_ch_stats," + getLoggingId() + - " bRecv=" + statistics.bytesReceived + - ",bSent=" + statistics.bytesSent + - ",pRecv=" + statistics.packetsReceived + - ",pSent=" + statistics.packetsSent + - ",bRetr=" + streamStats.getBytesRetransmitted() + - ",bNotRetr=" + streamStats.getBytesNotRetransmitted() + - ",pRetr=" + streamStats.getPacketsRetransmitted() + - ",pNotRetr=" + streamStats.getPacketsNotRetransmitted() + - ",pMiss=" + streamStats.getPacketsMissingFromCache()); + MediaStream stream = this.stream; + TrackStats streamStats; + if (stream != null && + (streamStats = stream.getMediaStreamStats().getSendStats()) + != null) + { + logger.info(Logger.Category.STATISTICS, + "expire_ch_stats," + getLoggingId() + + " bRecv=" + statistics.bytesReceived + + ",bSent=" + statistics.bytesSent + + ",pRecv=" + statistics.packetsReceived + + ",pSent=" + statistics.packetsSent + + ",bRetr=" + + streamStats.getBytesRetransmitted() + + ",bNotRetr=" + + streamStats.getBytesNotRetransmitted() + + ",pRetr=" + + streamStats.getPacketsRetransmitted() + + ",pNotRetr=" + + streamStats.getPacketsNotRetransmitted() + + ",pMiss=" + + streamStats.getPacketsMissingFromCache()); + } } } From fc081a05906a3162ee1d4d193c8f049346fbba97 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Fri, 31 Aug 2018 17:21:25 -0500 Subject: [PATCH 2/8] fix: Adds a null check. --- src/main/java/org/jitsi/videobridge/AbstractEndpoint.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/jitsi/videobridge/AbstractEndpoint.java b/src/main/java/org/jitsi/videobridge/AbstractEndpoint.java index edeb973fa3..2d702e79d3 100644 --- a/src/main/java/org/jitsi/videobridge/AbstractEndpoint.java +++ b/src/main/java/org/jitsi/videobridge/AbstractEndpoint.java @@ -419,6 +419,7 @@ protected List getAllMediaStreamTracks( List allTracks = new LinkedList<>(); channels.stream() .map(channel -> channel.getStream().getMediaStreamTrackReceiver()) + .filter(Objects::nonNull) .forEach( trackReceiver -> allTracks.addAll( Arrays.asList(trackReceiver.getMediaStreamTracks()))); From 8866281df8488e853478f2c444fad477b23b65f4 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Fri, 31 Aug 2018 17:24:11 -0500 Subject: [PATCH 3/8] fix: Fixes a ConcurrentModificationException. --- src/main/java/org/jitsi/videobridge/Conference.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jitsi/videobridge/Conference.java b/src/main/java/org/jitsi/videobridge/Conference.java index 3425e19bfe..7502734e69 100644 --- a/src/main/java/org/jitsi/videobridge/Conference.java +++ b/src/main/java/org/jitsi/videobridge/Conference.java @@ -491,8 +491,10 @@ private void closeTransportManagers() { synchronized (transportManagers) { - transportManagers.forEach((id, tm) -> closeTransportManager(tm)); - transportManagers.clear(); + Collection transportManagers + = new LinkedList<>(this.transportManagers.values()); + transportManagers.forEach(this::closeTransportManager); + this.transportManagers.clear(); } } From 708e8853187c24afdec2161858b96bdaad06ea71 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Tue, 4 Sep 2018 12:38:02 -0500 Subject: [PATCH 4/8] fix: Adds null checks. --- .../videobridge/cc/SimulcastController.java | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jitsi/videobridge/cc/SimulcastController.java b/src/main/java/org/jitsi/videobridge/cc/SimulcastController.java index da617dd39b..091aea3583 100644 --- a/src/main/java/org/jitsi/videobridge/cc/SimulcastController.java +++ b/src/main/java/org/jitsi/videobridge/cc/SimulcastController.java @@ -1525,10 +1525,27 @@ boolean accept(FrameDesc source, RawPacket pkt) private RawPacket handleVp8PictureIdRewriting(RawPacket pktOut) { MediaStreamTrackDesc source = weakSource.get(); - assert source != null; + if (source == null) + { + logger.error("Source is null, dropping packet."); + return null; + } - REDBlock redBlock = source.getMediaStreamTrackReceiver() - .getStream().getPrimaryREDBlock(pktOut); + MediaStreamTrackReceiver trackReceiver + = source.getMediaStreamTrackReceiver(); + if (trackReceiver == null) + { + logger.error("Track receiver is null, dropping packet."); + return null; + } + + MediaStream stream = trackReceiver.getStream(); + if (stream == null) + { + logger.error("Stream is null, dropping packet."); + return null; + } + REDBlock redBlock = stream.getPrimaryREDBlock(pktOut); if (!DePacketizer .VP8PayloadDescriptor.hasExtendedPictureId( From 6fb872f4abe6b97582f0aea370816e8dc10f1bca Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Tue, 4 Sep 2018 12:38:18 -0500 Subject: [PATCH 5/8] fix: Fixes the logger initialization. --- .../org/jitsi/videobridge/AbstractEndpointMessageTransport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jitsi/videobridge/AbstractEndpointMessageTransport.java b/src/main/java/org/jitsi/videobridge/AbstractEndpointMessageTransport.java index 2b534b3274..79b9269935 100644 --- a/src/main/java/org/jitsi/videobridge/AbstractEndpointMessageTransport.java +++ b/src/main/java/org/jitsi/videobridge/AbstractEndpointMessageTransport.java @@ -38,7 +38,7 @@ public abstract class AbstractEndpointMessageTransport * information. */ private static final Logger classLogger - = Logger.getLogger(EndpointMessageTransport.class); + = Logger.getLogger(AbstractEndpointMessageTransport.class); /** * The {@link Endpoint} associated with this From c984de89895bf4aef935226dbf4a871d464f59aa Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Tue, 4 Sep 2018 13:05:32 -0500 Subject: [PATCH 6/8] fix: Sets the so timeout for Octo sockets. --- .../videobridge/octo/OctoTransportManager.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jitsi/videobridge/octo/OctoTransportManager.java b/src/main/java/org/jitsi/videobridge/octo/OctoTransportManager.java index 83595ca5b0..c3fac1b6de 100644 --- a/src/main/java/org/jitsi/videobridge/octo/OctoTransportManager.java +++ b/src/main/java/org/jitsi/videobridge/octo/OctoTransportManager.java @@ -233,7 +233,7 @@ private void initializeSockets() private DatagramSocket createOctoSocket(DatagramSocket socket) throws SocketException { - return new DelegatingDatagramSocket(socket) + DatagramSocket s = new DelegatingDatagramSocket(socket) { @Override public void receive(DatagramPacket p) @@ -268,6 +268,18 @@ public void send(DatagramPacket p) doSend(p, true); } }; + + // With the hierarchy of sockets that we use for Octo (Delegating -> + // Multiplexed -> Multiplexing -> DatagramSocket) the calls receive() + // are handled by the Multiplexing instance. Since it is persistent, it + // will not get closed when this socket instance is closed, and will + // therefore not throw a SocketClosedException. This means that we can + // not relay on this exception to stop the receive thread + // (RTPConnectorInputStream#receiveThread), and therefore we need a + // finite timeout. + s.setSoTimeout(1000); + + return s; } /** From 42fae99c33e67b38b8782725eb14d5f548ed8836 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Tue, 4 Sep 2018 13:33:54 -0500 Subject: [PATCH 7/8] minor: Extracts a constant, fixes a typo. --- .../org/jitsi/videobridge/octo/OctoTransportManager.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jitsi/videobridge/octo/OctoTransportManager.java b/src/main/java/org/jitsi/videobridge/octo/OctoTransportManager.java index c3fac1b6de..a817ff19e7 100644 --- a/src/main/java/org/jitsi/videobridge/octo/OctoTransportManager.java +++ b/src/main/java/org/jitsi/videobridge/octo/OctoTransportManager.java @@ -51,6 +51,11 @@ public class OctoTransportManager */ public static final String NAMESPACE = "http://jitsi.org/octo"; + /** + * The timeout to set on the sockets that we create. + */ + private static final int SO_TIMEOUT = 1000; + /** * Converts a "relay ID" to a socket address. The current implementation * assumes that the ID has the form of "address:port". @@ -274,10 +279,10 @@ public void send(DatagramPacket p) // are handled by the Multiplexing instance. Since it is persistent, it // will not get closed when this socket instance is closed, and will // therefore not throw a SocketClosedException. This means that we can - // not relay on this exception to stop the receive thread + // not rely on this exception to stop the receive thread // (RTPConnectorInputStream#receiveThread), and therefore we need a // finite timeout. - s.setSoTimeout(1000); + s.setSoTimeout(SO_TIMEOUT); return s; } From 5e3b91231938c890cbae3da50aac4c287195b290 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Tue, 4 Sep 2018 14:28:59 -0500 Subject: [PATCH 8/8] mvn: Updates libjitsi to 017195565dd237d5c83d3e81c44291446ffbb0af. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a3ea8e431d..76e873a683 100644 --- a/pom.xml +++ b/pom.xml @@ -157,7 +157,7 @@ ${project.groupId} libjitsi - 1.0-20180821.201225-361 + 1.0-20180904.192703-363