/** * Adds a specific (RTP) SSRC to the list of SSRCs seen/received on this <tt>Channel</tt>. * Invoked by the Jitsi Videobridge server, not its clients. * * @param ssrc the (RTP) SSRC to be added to the list of SSRCs seen/received on this * <tt>Channel</tt> * @return <tt>true</tt> if the list of SSRCs seen/received on this <tt>Channel</tt> has been * modified as part of the method call; otherwise, <tt>false</tt> */ public synchronized boolean addSSRC(int ssrc) { // contains for (int i = 0; i < ssrcs.length; i++) if (ssrcs[i] == ssrc) return false; // add int[] newSSRCs = new int[ssrcs.length + 1]; System.arraycopy(ssrcs, 0, newSSRCs, 0, ssrcs.length); newSSRCs[ssrcs.length] = ssrc; ssrcs = newSSRCs; return true; }
/** * Removes a specific (RTP) SSRC from the list of SSRCs seen/received on this <tt>Channel</tt>. * Invoked by the Jitsi Videobridge server, not its clients. * * @param ssrc the (RTP) SSRC to be removed from the list of SSRCs seen/received on this * <tt>Channel</tt> * @return <tt>true</tt> if the list of SSRCs seen/received on this <tt>Channel</tt> has been * modified as part of the method call; otherwise, <tt>false</tt> */ public synchronized boolean removeSSRC(int ssrc) { if (ssrcs.length == 1) { if (ssrcs[0] == ssrc) { ssrcs = NO_SSRCS; return true; } else return false; } else { for (int i = 0; i < ssrcs.length; i++) { if (ssrcs[i] == ssrc) { int[] newSSRCs = new int[ssrcs.length - 1]; if (i != 0) System.arraycopy(ssrcs, 0, newSSRCs, 0, i); if (i != newSSRCs.length) { System.arraycopy(ssrcs, i + 1, newSSRCs, i, newSSRCs.length - i); } ssrcs = newSSRCs; return true; } } return false; } }