@Override public void packetReady(final AudioUser user) { synchronized (userPackets) { if (!userPackets.containsKey(user.getUser())) { host.setTalkState(user.getUser(), AudioOutputHost.STATE_TALKING); userPackets.put(user.getUser(), user); userPackets.notify(); } } }
public void addFrameToBuffer(final User u, final PacketDataStream pds, final int flags) { AudioUser user = users.get(u); if (user == null) { user = new AudioUser(u, settings.isJitterBuffer()); users.put(u, user); // Don't add the user to userPackets yet. The collection should // have only users with ready frames. Since this method is // called only from the TCP connection thread it will never // create a new AudioUser while a previous one is still decoding. } user.addFrameToBuffer(pds, packetReadyHandler); }
private void fillMixFrames(final List<AudioUser> mix) { synchronized (userPackets) { final Iterator<AudioUser> i = userPackets.values().iterator(); while (i.hasNext()) { final AudioUser user = i.next(); if (user.hasFrame()) { if (!user.getUser().localMuted) { mix.add(user); } } else { i.remove(); host.setTalkState(user.getUser(), AudioOutputHost.STATE_PASSIVE); } } } }