Class RTPTranslatorImpl
- java.lang.Object
-
- org.jitsi.service.neomedia.AbstractRTPTranslator
-
- org.jitsi.impl.neomedia.rtp.translator.RTPTranslatorImpl
-
- All Implemented Interfaces:
EventListener,javax.media.rtp.ReceiveStreamListener,RTPTranslator
public class RTPTranslatorImpl extends AbstractRTPTranslator implements javax.media.rtp.ReceiveStreamListener
Implements RTPTranslator which represents an RTP translator which forwards RTP and RTCP traffic between multiple MediaStreams.- Author:
- Lyubomir Marinov
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jitsi.service.neomedia.RTPTranslator
RTPTranslator.WriteFilter
-
-
Constructor Summary
Constructors Constructor Description RTPTranslatorImpl()Initializes a new RTPTranslatorImpl instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFormat(StreamRTPManager streamRTPManager, javax.media.Format format, int payloadType)Specifies the RTP payload type (number) to be used for a specific Format.voidaddReceiveStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.ReceiveStreamListener listener)Adds a ReceiveStreamListener to be notified about ReceiveStreamEvents related to a specific neomedia MediaStream (expressed as a StreamRTPManager for the purposes of and in the terms of RTPTranslator).voidaddRemoteListener(StreamRTPManager streamRTPManager, javax.media.rtp.RemoteListener listener)Adds a RemoteListener to be notified about RemoteEvents received by this RTPTranslatorImpl.voidaddSendStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.SendStreamListener listener)Not implemented because there are currently no uses of the underlying functionality.voidaddSessionListener(StreamRTPManager streamRTPManager, javax.media.rtp.SessionListener listener)Not implemented because there are currently no uses of the underlying functionality.javax.media.rtp.SendStreamcreateSendStream(StreamRTPManager streamRTPManager, javax.media.protocol.DataSource dataSource, int streamIndex)Creates a SendStream from the stream of a specific DataSource that is at a specific zero-based position within the array/list of streams of that DataSource.voiddispose()Releases the resources allocated by this instance in the course of its execution and prepares it to be garbage collected.voiddispose(StreamRTPManager streamRTPManager)Releases the resources allocated by this instance for the purposes of the functioning of a specific StreamRTPManager in the course of its execution and prepares that StreamRTPManager to be garbage collected (as far as this RTPTranslatorImpl is concerned).StreamRTPManagerfindStreamRTPManagerByReceiveSSRC(int receiveSSRC)Finds theStreamRTPManagerwhich receives a specific SSRC.ObjectgetControl(StreamRTPManager streamRTPManager, String controlType)ExposesControls.getControl(String)on the internal/underlying RTPManager.javax.media.rtp.GlobalReceptionStatsgetGlobalReceptionStats(StreamRTPManager streamRTPManager)ExposesRTPManager.getGlobalReceptionStats()on the internal/underlying RTPManager.javax.media.rtp.GlobalTransmissionStatsgetGlobalTransmissionStats(StreamRTPManager streamRTPManager)ExposesRTPManager.getGlobalTransmissionStats()on the internal/underlying RTPManager.longgetLocalSSRC(StreamRTPManager streamRTPManager)ExposesRTPSessionMgr.getLocalSSRC()on the internal/underlying RTPSessionMgr.Vector<javax.media.rtp.ReceiveStream>getReceiveStreams(StreamRTPManager streamRTPManager)Gets the ReceiveStreams associated with/related to a neomedia MediaStream (specified in the form of a StreamRTPManager instance for the purposes of and in the terms of RTPManagerImpl).RTCPFeedbackMessageSendergetRtcpFeedbackMessageSender()Gets the RTCPFeedbackMessageSender which should be used for sending RTCP Feedback Messages from this RTPTranslator.Vector<javax.media.rtp.SendStream>getSendStreams(StreamRTPManager streamRTPManager)Gets the SendStreams associated with/related to a neomedia MediaStream (specified in the form of a StreamRTPManager instance for the purposes of and in the terms of RTPManagerImpl).net.sf.fmj.media.rtp.SSRCCachegetSSRCCache()Provides access to the underlying SSRCCache that holds statistics information about each SSRC that we receive.List<StreamRTPManager>getStreamRTPManagers()Returns a list of StreamRTPManagers currently attached to this RTPTranslator.voidinitialize(StreamRTPManager streamRTPManager, javax.media.rtp.RTPConnector connector)voidremoveReceiveStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.ReceiveStreamListener listener)Removes a ReceiveStreamListener to no longer be notified about ReceiveStreamEvents related to a specific neomedia MediaStream (expressed as a StreamRTPManager for the purposes of and in the terms of RTPTranslator).voidremoveRemoteListener(StreamRTPManager streamRTPManager, javax.media.rtp.RemoteListener listener)Removes a RemoteListener to no longer be notified about RemoteEvents received by this RTPTranslatorImpl.voidremoveSendStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.SendStreamListener listener)Not implemented because there are currently no uses of the underlying functionality.voidremoveSessionListener(StreamRTPManager streamRTPManager, javax.media.rtp.SessionListener listener)Not implemented because there are currently no uses of the underlying functionality.voidsetSSRCFactory(SSRCFactory ssrcFactory)Sets the SSRCFactory which is to generate new synchronization source (SSRC) identifiers.voidupdate(javax.media.rtp.event.ReceiveStreamEvent event)Notifies this ReceiveStreamListener about a specific event related to a ReceiveStream.booleanwriteControlPayload(Payload controlPayload, MediaStream destination)Writes an RTCPFeedbackMessage into a destination identified by a specific MediaStream.-
Methods inherited from class org.jitsi.service.neomedia.AbstractRTPTranslator
addWriteFilter, getWriteFilters, removeWriteFilter, willWrite, willWrite
-
-
-
-
Method Detail
-
addFormat
public void addFormat(StreamRTPManager streamRTPManager, javax.media.Format format, int payloadType)
Specifies the RTP payload type (number) to be used for a specific Format. The association between the specified format and the specified payloadType is being added by a specific StreamRTPManager but effects the RTPTranslatorImpl globally.- Parameters:
streamRTPManager- the StreamRTPManager that is requesting the association of format to payloadTypeformat- the Format which is to be associated with the specified RTP payload type (number)payloadType- the RTP payload type (number) to be associated with the specified format
-
addReceiveStreamListener
public void addReceiveStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.ReceiveStreamListener listener)
Adds a ReceiveStreamListener to be notified about ReceiveStreamEvents related to a specific neomedia MediaStream (expressed as a StreamRTPManager for the purposes of and in the terms of RTPTranslator). If the specified listener has already been added, the method does nothing.- Parameters:
streamRTPManager- the StreamRTPManager which specifies the neomedia MediaStream with which the ReceiveStreamEvents delivered to the specified listener are to be related. In other words, a ReceiveStreamEvent received by RTPTranslatorImpl is first examined to determine which StreamRTPManager it is related to and then it is delivered to the ReceiveStreamListeners which have been added to this RTPTranslatorImpl by that StreamRTPManager.listener- the ReceiveStreamListener to be notified about ReceiveStreamEvents related to the specified streamRTPManager
-
addRemoteListener
public void addRemoteListener(StreamRTPManager streamRTPManager, javax.media.rtp.RemoteListener listener)
Adds a RemoteListener to be notified about RemoteEvents received by this RTPTranslatorImpl. Though the request is being made by a specific StreamRTPManager, the addition of the specified listener and the deliveries of the RemoteEvents are performed irrespective of any StreamRTPManager.- Parameters:
streamRTPManager- the StreamRTPManager which is requesting the addition of the specified RemoteListenerlistener- the RemoteListener to be notified about RemoteEvents received by this RTPTranslatorImpl
-
addSendStreamListener
public void addSendStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.SendStreamListener listener)
Not implemented because there are currently no uses of the underlying functionality.
-
addSessionListener
public void addSessionListener(StreamRTPManager streamRTPManager, javax.media.rtp.SessionListener listener)
Not implemented because there are currently no uses of the underlying functionality.
-
createSendStream
public javax.media.rtp.SendStream createSendStream(StreamRTPManager streamRTPManager, javax.media.protocol.DataSource dataSource, int streamIndex) throws IOException, javax.media.format.UnsupportedFormatException
Creates a SendStream from the stream of a specific DataSource that is at a specific zero-based position within the array/list of streams of that DataSource.- Parameters:
streamRTPManager- the StreamRTPManager which is requesting the creation of a SendStream. Since multiple StreamRTPManager may request the creation of a SendStream from one and the same combination of dataSource and streamIndex, the method may not create a completely new SendStream but may return a StreamRTPManager-specific view of an existing SendStream.dataSource- the DataSource which provides the stream from which a SendStream is to be createdstreamIndex- the zero-based position within the array/list of streams of the specified dataSource of the stream from which a SendStream is to be created- Returns:
- a SendStream created from the specified dataSource and streamIndex. The returned SendStream implementation is a streamRTPManager-dedicated view to an actual SendStream which may have been created during a previous execution of the method
- Throws:
IOException- if an error occurs during the execution ofRTPManager.createSendStream(DataSource, int)javax.media.format.UnsupportedFormatException- if an error occurs during the execution of RTPManager.createSendStream(DataSource, int)
-
dispose
public void dispose()
Releases the resources allocated by this instance in the course of its execution and prepares it to be garbage collected.- Specified by:
disposein interfaceRTPTranslator
-
dispose
public void dispose(StreamRTPManager streamRTPManager)
Releases the resources allocated by this instance for the purposes of the functioning of a specific StreamRTPManager in the course of its execution and prepares that StreamRTPManager to be garbage collected (as far as this RTPTranslatorImpl is concerned).
-
findStreamRTPManagerByReceiveSSRC
public StreamRTPManager findStreamRTPManagerByReceiveSSRC(int receiveSSRC)
Finds theStreamRTPManagerwhich receives a specific SSRC.- Specified by:
findStreamRTPManagerByReceiveSSRCin interfaceRTPTranslator- Parameters:
receiveSSRC- the SSRC of the RTP stream received by theStreamRTPManagerto be returned- Returns:
- the
StreamRTPManagerwhich receivesreceiveSSRCofnull
-
getControl
public Object getControl(StreamRTPManager streamRTPManager, String controlType)
ExposesControls.getControl(String)on the internal/underlying RTPManager.- Parameters:
streamRTPManager- ignoredcontrolType-- Returns:
- the return value of the invocation of RTPManager.getControl(String) on the internal/underlying RTPManager
-
getGlobalReceptionStats
public javax.media.rtp.GlobalReceptionStats getGlobalReceptionStats(StreamRTPManager streamRTPManager)
ExposesRTPManager.getGlobalReceptionStats()on the internal/underlying RTPManager.- Parameters:
streamRTPManager- ignored- Returns:
- the return value of the invocation of RTPManager.getGlobalReceptionStats() on the internal/underlying RTPManager
-
getGlobalTransmissionStats
public javax.media.rtp.GlobalTransmissionStats getGlobalTransmissionStats(StreamRTPManager streamRTPManager)
ExposesRTPManager.getGlobalTransmissionStats()on the internal/underlying RTPManager.- Parameters:
streamRTPManager- ignored- Returns:
- the return value of the invocation of RTPManager.getGlobalTransmissionStats() on the internal/underlying RTPManager
-
getLocalSSRC
public long getLocalSSRC(StreamRTPManager streamRTPManager)
ExposesRTPSessionMgr.getLocalSSRC()on the internal/underlying RTPSessionMgr.- Parameters:
streamRTPManager- ignored- Returns:
- the return value of the invocation of RTPSessionMgr.getLocalSSRC() on the internal/underlying RTPSessionMgr
-
getReceiveStreams
public Vector<javax.media.rtp.ReceiveStream> getReceiveStreams(StreamRTPManager streamRTPManager)
Gets the ReceiveStreams associated with/related to a neomedia MediaStream (specified in the form of a StreamRTPManager instance for the purposes of and in the terms of RTPManagerImpl).- Parameters:
streamRTPManager- the StreamRTPManager to which the returned ReceiveStreams are to be related- Returns:
- the ReceiveStreams related to/associated with the specified streamRTPManager
-
getRtcpFeedbackMessageSender
public RTCPFeedbackMessageSender getRtcpFeedbackMessageSender()
Gets the RTCPFeedbackMessageSender which should be used for sending RTCP Feedback Messages from this RTPTranslator.- Returns:
- the RTCPFeedbackMessageSender which should be used for sending RTCP Feedback Messages from this RTPTranslator.
-
getSendStreams
public Vector<javax.media.rtp.SendStream> getSendStreams(StreamRTPManager streamRTPManager)
Gets the SendStreams associated with/related to a neomedia MediaStream (specified in the form of a StreamRTPManager instance for the purposes of and in the terms of RTPManagerImpl).- Parameters:
streamRTPManager- the StreamRTPManager to which the returned SendStreams are to be related- Returns:
- the SendStreams related to/associated with the specified streamRTPManager
-
getStreamRTPManagers
public List<StreamRTPManager> getStreamRTPManagers()
Returns a list of StreamRTPManagers currently attached to this RTPTranslator. This is admittedly wrong, to expose the bare SSRCCache to the use of of the StreamRTPManager. We should find a better way of exposing this information. Currently it is necessary for RTCP termination.- Specified by:
getStreamRTPManagersin interfaceRTPTranslator- Returns:
- a list of StreamRTPManagers currently attached to this RTPTranslator.
-
initialize
public void initialize(StreamRTPManager streamRTPManager, javax.media.rtp.RTPConnector connector)
-
removeReceiveStreamListener
public void removeReceiveStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.ReceiveStreamListener listener)
Removes a ReceiveStreamListener to no longer be notified about ReceiveStreamEvents related to a specific neomedia MediaStream (expressed as a StreamRTPManager for the purposes of and in the terms of RTPTranslator). SinceaddReceiveStreamListener(StreamRTPManager, ReceiveStreamListener)does not add equal ReceiveStreamListeners, a single removal is enough to reverse multiple additions of equal ReceiveStreamListeners.- Parameters:
streamRTPManager- the StreamRTPManager which specifies the neomedia MediaStream with which the ReceiveStreamEvents delivered to the specified listener are to be relatedlistener- the ReceiveStreamListener to no longer be notified about ReceiveStreamEvents related to the specified streamRTPManager
-
removeRemoteListener
public void removeRemoteListener(StreamRTPManager streamRTPManager, javax.media.rtp.RemoteListener listener)
Removes a RemoteListener to no longer be notified about RemoteEvents received by this RTPTranslatorImpl. Though the request is being made by a specific StreamRTPManager, the addition of the specified listener and the deliveries of the RemoteEvents are performed irrespective of any StreamRTPManager so the removal follows the same logic.- Parameters:
streamRTPManager- the StreamRTPManager which is requesting the removal of the specified RemoteListenerlistener- the RemoteListener to no longer be notified about RemoteEvents received by this RTPTranslatorImpl
-
removeSendStreamListener
public void removeSendStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.SendStreamListener listener)
Not implemented because there are currently no uses of the underlying functionality. (Additionally,addSendStreamListener(StreamRTPManager, SendStreamListener)is not implemented for the same reason.)
-
removeSessionListener
public void removeSessionListener(StreamRTPManager streamRTPManager, javax.media.rtp.SessionListener listener)
Not implemented because there are currently no uses of the underlying functionality. (Additionally,addSessionListener(StreamRTPManager, SessionListener)is not implemented for the same reason.)
-
setSSRCFactory
public void setSSRCFactory(SSRCFactory ssrcFactory)
Sets the SSRCFactory which is to generate new synchronization source (SSRC) identifiers.- Parameters:
ssrcFactory- the SSRCFactory which is to generate new synchronization source (SSRC) identifiers or null if this MediaStream is to employ internal logic to generate new synchronization source (SSRC) identifiers
-
update
public void update(javax.media.rtp.event.ReceiveStreamEvent event)
Notifies this ReceiveStreamListener about a specific event related to a ReceiveStream.- Specified by:
updatein interfacejavax.media.rtp.ReceiveStreamListener- Parameters:
event- a ReceiveStreamEvent which contains the specifics of the event this ReceiveStreamListener is being notified about- See Also:
ReceiveStreamListener.update(ReceiveStreamEvent)
-
writeControlPayload
public boolean writeControlPayload(Payload controlPayload, MediaStream destination)
Writes an RTCPFeedbackMessage into a destination identified by a specific MediaStream.- Returns:
- true if the controlPayload was written into the destination; otherwise, false
-
getSSRCCache
public net.sf.fmj.media.rtp.SSRCCache getSSRCCache()
Provides access to the underlying SSRCCache that holds statistics information about each SSRC that we receive.- Specified by:
getSSRCCachein interfaceRTPTranslator- Returns:
- the underlying SSRCCache that holds statistics information about each SSRC that we receive.
-
-