/** * JingleSessionListener. */ @Override public synchronized void update(SessionEvent evt) { if (evt instanceof NewParticipantEvent) { Participant p = ((NewParticipantEvent) evt).getParticipant(); LOGGER.fine(" - A new participant had just joined: " + p.getCNAME()); } }
/** * Set transmit activity. If the active is true, the instance should transmit. * If it is set to false, the instance should pause transmit. * * @param active active state */ public void setTrasmit(boolean active) { for (SendStream sendStream : sendStreams) { try { if (active) { sendStream.start(); LOGGER.fine("START"); } else { sendStream.stop(); LOGGER.fine("STOP"); } } catch (IOException e) { LOGGER.log(Level.WARNING, "exception", e); } } }
/** * Stops the transmission if already started. * Stops the receiver also. */ public void stop() { if (!started) return; synchronized (this) { try { started = false; if (processor != null) { processor.stop(); processor = null; for (RTPManager rtpMgr : rtpMgrs) { rtpMgr.removeReceiveStreamListener(audioReceiver); rtpMgr.removeSessionListener(audioReceiver); rtpMgr.removeTargets("Session ended."); rtpMgr.dispose(); } sendStreams.clear(); } } catch (Exception e) { LOGGER.log(Level.WARNING, "exception", e); } } }
rtpMgrs[i] = RTPManager.newInstance(); localAddr = new SessionAddress(InetAddress.getByName(this.localIpAddress), localPort); destAddr = new SessionAddress(ipAddr, port); rtpMgrs[i].addReceiveStreamListener(audioReceiver); rtpMgrs[i].addSessionListener(audioReceiver); BufferControl bc = (BufferControl) rtpMgrs[i].getControl("javax.media.control.BufferControl"); if (bc != null) { int bl = 160; rtpMgrs[i].initialize(localAddr); SessionAddress sessAddr = new SessionAddress(); localAddr = new SessionAddress(sessAddr.getDataAddress(), localPort); rtpMgrs[i].initialize(localAddr); rtpMgrs[i].addTarget(destAddr); sendStream = rtpMgrs[i].createSendStream(dataOutput, i); sendStream.start();
public synchronized void update(ReceiveStreamEvent evt) { Participant participant = evt.getParticipant(); // could be null. ReceiveStream stream = evt.getReceiveStream(); // could be null. stream = evt.getReceiveStream(); DataSource ds = stream.getDataSource(); LOGGER.severe(" - Received new RTP stream: " + ctl.getFormat()); LOGGER.severe(" The sender of this stream had yet to be identified."); else { LOGGER.severe(" The stream comes from: " + participant.getCNAME()); jingleMediaSession.mediaReceived(participant != null ? participant.getCNAME() : ""); if (stream != null && stream.getDataSource() != null) { DataSource ds = stream.getDataSource(); LOGGER.severe(" " + ctl.getFormat()); LOGGER.severe(" had now been identified as sent by: " + participant.getCNAME()); LOGGER.severe(" - Got \"bye\" from: " + participant.getCNAME());
InetAddress ctrlAddr = streamTarget.getControlAddress(); int ctrlPort = streamTarget.getControlPort(); boolean accept; streamTarget.setControlHostAddress(p.getAddress()); streamTarget.setControlPort(p.getPort()); InetAddress dataAddr = streamTarget.getDataAddress(); int dataPort = streamTarget.getDataPort(); ctrlAddr = streamTarget.getControlAddress(); ctrlPort = streamTarget.getControlPort();
RTPManager rtpManager = RTPManager.newInstance(); rtpManager.initialize(localAddress); rtpManager.addTarget(multiAddress);
/** * Sets the direction of the <tt>MediaStream</tt> of this <tt>Channel</tt>. * <p> * <b>Warning</b>: The method does nothing if latching has not finished. * </p> * * @param direction the <tt>MediaDirection</tt> to set on the * <tt>MediaStream</tt> of this <tt>Channel</tt> */ public void setDirection(MediaDirection direction) { // XXX We modify the stream direction only after latching has finished. if (streamTarget.getDataAddress() != null) { stream.setDirection(direction); } touch(); // It seems this Channel is still active. }
/** * Initializes a new <tt>RTPTranslatorImpl</tt> instance. */ public RTPTranslatorImpl() { manager.addReceiveStreamListener(this); }
this.streamTarget.setDataHostAddress(dataAddr.getAddress()); this.streamTarget.setDataPort(dataAddr.getPort()); this.streamTarget.setControlHostAddress(ctrlAddr.getAddress()); this.streamTarget.setControlPort(ctrlAddr.getPort());
/** * Returns the number of lost packets for the receive streams. * @return the number of lost packets for the receive streams. */ public long getDownloadNbPacketLost() { long downloadLost = 0; for(ReceiveStream stream : mediaStreamImpl.getReceiveStreams()) { downloadLost += stream.getSourceReceptionStats().getPDUlost(); } return downloadLost; }
@Override public DataSource getDataSource() { return sendStreamDesc.sendStream.getDataSource(); }
@Override public TransmissionStats getSourceTransmissionStats() { return sendStreamDesc.sendStream.getSourceTransmissionStats(); }
@Override public Participant getParticipant() { return sendStreamDesc.sendStream.getParticipant(); }
@Override public SenderReport getSenderReport() { return sendStreamDesc.sendStream.getSenderReport(); }
@Override public long getSSRC() { return sendStreamDesc.sendStream.getSSRC(); }
/** * {@inheritDoc} */ @Override public int write(byte[] buf, int off, int len) { return _outputDataStream.write(buf, off, len); } }
/** * Exposes {@link RTPManager#getGlobalTransmissionStats()} on the * internal/underlying <tt>RTPManager</tt>. * * @param streamRTPManager ignored * @return the return value of the invocation of * <tt>RTPManager.getGlobalTransmissionStats()</tt> on the * internal/underlying <tt>RTPManager</tt> */ public GlobalTransmissionStats getGlobalTransmissionStats( StreamRTPManager streamRTPManager) { return manager.getGlobalTransmissionStats(); }
/** * Exposes {@link RTPManager#getGlobalReceptionStats()} on the * internal/underlying <tt>RTPManager</tt>. * * @param streamRTPManager ignored * @return the return value of the invocation of * <tt>RTPManager.getGlobalReceptionStats()</tt> on the internal/underlying * <tt>RTPManager</tt> */ public GlobalReceptionStats getGlobalReceptionStats( StreamRTPManager streamRTPManager) { return manager.getGlobalReceptionStats(); }
RTPManager rtpManager = RTPManager.newInstance(); rtpManager.initialize(multiAddress); rtpManager.addTarget(multiAddress);