rtpMgrs[i] = RTPManager.newInstance(); 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); localAddr = new SessionAddress(sessAddr.getDataAddress(), localPort); rtpMgrs[i].initialize(localAddr); rtpMgrs[i].addTarget(destAddr); sendStream = rtpMgrs[i].createSendStream(dataOutput, i);
/** * 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); } } }
RTPManager rtpManager = RTPManager.newInstance(); rtpManager.initialize(localAddress); rtpManager.addTarget(multiAddress);
rtpManager = RTPManager.newInstance(); rtpManager.addFormat(vp8RtpFormat, vp8PayloadType); rtpManager.addFormat(opusFormat, opusPayloadType); rtpManager.addReceiveStreamListener(this); rtpManager.initialize(rtpConnector);
manager.removeReceiveStreamListener(this); try manager.dispose();
public void initialize(RTPConnector connector) { if (translator == null) manager.initialize(connector); else translator.initialize(this, connector); }
/** * Initializes a new <tt>RTPTranslatorImpl</tt> instance. */ public RTPTranslatorImpl() { manager.addReceiveStreamListener(this); }
public SendStream createSendStream(DataSource dataSource, int streamIndex) throws IOException, UnsupportedFormatException { if (translator == null) return manager.createSendStream(dataSource, streamIndex); else return translator.createSendStream(this, dataSource, streamIndex); }
public void dispose() { if (translator == null) manager.dispose(); else translator.dispose(this); }
/** * Exposes {@link RTPManager#getControl(String)} on the internal/underlying * <tt>RTPManager</tt>. * * @param streamRTPManager ignored * @param controlType * @return the return value of the invocation of * <tt>RTPManager.getControl(String)</tt> on the internal/underlying * <tt>RTPManager</tt> */ public Object getControl( StreamRTPManager streamRTPManager, String controlType) { return manager.getControl(controlType); }
/** * Initializes a new <tt>StreamRTPManager</tt> instance which is, * optionally, attached to a specific <tt>RTPTranslator</tt> which is to * forward the RTP and RTCP flows of the associated <tt>MediaStream</tt> to * other <tt>MediaStream</tt>s. * * @param stream the <tt>MediaStream</tt> that created this * <tt>StreamRTPManager</tt>. * @param translator the <tt>RTPTranslator</tt> to attach the new instance * to or <tt>null</tt> if the new instance is to not be attached to any * <tt>RTPTranslator</tt> */ public StreamRTPManager(MediaStream stream, RTPTranslator translator) { this.stream = stream; this.translator = (RTPTranslatorImpl) translator; manager = (this.translator == null) ? RTPManager.newInstance() : null; }
public void addSessionListener(SessionListener listener) { if (translator == null) manager.addSessionListener(listener); else translator.addSessionListener(this, listener); }
public void removeSessionListener(SessionListener listener) { if (translator == null) manager.removeSessionListener(listener); else translator.removeSessionListener(this, listener); }
public void removeReceiveStreamListener(ReceiveStreamListener listener) { if (translator == null) manager.removeReceiveStreamListener(listener); else translator.removeReceiveStreamListener(this, listener); }
RTPManager rtpManager = RTPManager.newInstance(); rtpManager.initialize(multiAddress); rtpManager.addTarget(multiAddress);
manager.initialize(this.connector);
public void addReceiveStreamListener(ReceiveStreamListener listener) { if (translator == null) manager.addReceiveStreamListener(listener); else translator.addReceiveStreamListener(this, listener); }
= manager.createSendStream(dataSource, streamIndex);
@Override public void stop() { if (started) { if (logger.isInfoEnabled()) logger.info("Stopping " + hashCode()); // remove the recorder from the translator (e.g. stop new packets from // being written to rtpConnector if (streamRTPManager != null) streamRTPManager.dispose(); HashSet<ReceiveStreamDesc> streamsToRemove = new HashSet<ReceiveStreamDesc>(); synchronized (receiveStreams) { streamsToRemove.addAll(receiveStreams); } for(ReceiveStreamDesc r : streamsToRemove) removeReceiveStream(r, false); rtpConnector.rtcpPacketTransformer.close(); rtpConnector.rtpPacketTransformer.close(); rtpManager.dispose(); if (activeSpeakerDetector != null) activeSpeakerDetector.removeActiveSpeakerChangedListener(this); started=false; } }
/** * Gets a control of a specific type over this instance. * * @param controlType a <tt>String</tt> which specifies the type (i.e. the * name of the class) of the control over this instance to get * @return a control of the specified <tt>controlType</tt> over this * instance if this instance supports such a control; otherwise, * <tt>null</tt> */ public Object getControl(String controlType) { if (translator == null) return manager.getControl(controlType); else return translator.getControl(this, controlType); }