public class RTPTranslatorImpl extends AbstractRTPTranslator implements javax.media.rtp.ReceiveStreamListener
RTPTranslator.WriteFilter
Constructor and Description |
---|
RTPTranslatorImpl()
Initializes a new RTPTranslatorImpl instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addFormat(StreamRTPManager streamRTPManager,
javax.media.Format format,
int payloadType)
Specifies the RTP payload type (number) to be used for a specific
Format.
|
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).
|
void |
addRemoteListener(StreamRTPManager streamRTPManager,
javax.media.rtp.RemoteListener listener)
Adds a RemoteListener to be notified about RemoteEvents
received by this RTPTranslatorImpl.
|
void |
addSendStreamListener(StreamRTPManager streamRTPManager,
javax.media.rtp.SendStreamListener listener)
Not implemented because there are currently no uses of the underlying
functionality.
|
void |
addSessionListener(StreamRTPManager streamRTPManager,
javax.media.rtp.SessionListener listener)
Not implemented because there are currently no uses of the underlying
functionality.
|
(package private) void |
closeSendStream(SendStreamDesc sendStreamDesc)
Closes a specific SendStream.
|
javax.media.rtp.SendStream |
createSendStream(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.
|
(package private) int |
didRead(PushSourceStreamDesc streamDesc,
byte[] buf,
int off,
int len,
int flags)
Notifies this instance that an RTP or RTCP packet has been received from
a peer represented by a specific PushSourceStreamDesc.
|
void |
dispose()
Releases the resources allocated by this instance in the course of its
execution and prepares it to be garbage collected.
|
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).
|
StreamRTPManager |
findStreamRTPManagerByReceiveSSRC(int receiveSSRC)
Finds the
StreamRTPManager which receives a specific SSRC. |
java.lang.Object |
getControl(StreamRTPManager streamRTPManager,
java.lang.String controlType)
Exposes
Controls.getControl(String) on the internal/underlying
RTPManager. |
javax.media.rtp.GlobalReceptionStats |
getGlobalReceptionStats(StreamRTPManager streamRTPManager)
Exposes
RTPManager.getGlobalReceptionStats() on the
internal/underlying RTPManager. |
javax.media.rtp.GlobalTransmissionStats |
getGlobalTransmissionStats(StreamRTPManager streamRTPManager)
Exposes
RTPManager.getGlobalTransmissionStats() on the
internal/underlying RTPManager. |
long |
getLocalSSRC(StreamRTPManager streamRTPManager)
Exposes
RTPSessionMgr.getLocalSSRC() on the internal/underlying
RTPSessionMgr. |
java.util.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).
|
RTCPFeedbackMessageSender |
getRtcpFeedbackMessageSender()
Gets the RTCPFeedbackMessageSender which should be used for
sending RTCP Feedback Messages from this RTPTranslator.
|
java.util.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.SSRCCache |
getSSRCCache()
Provides access to the underlying SSRCCache that holds
statistics information about each SSRC that we receive.
|
java.util.List<StreamRTPManager> |
getStreamRTPManagers()
Returns a list of StreamRTPManagers currently attached to
this RTPTranslator.
|
void |
initialize(StreamRTPManager streamRTPManager,
javax.media.rtp.RTPConnector connector) |
(package private) static void |
logRTCP(java.lang.Object obj,
java.lang.String methodName,
byte[] buf,
int off,
int len)
Logs information about an RTCP packet using
LOGGER for debugging
purposes. |
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).
|
void |
removeRemoteListener(StreamRTPManager streamRTPManager,
javax.media.rtp.RemoteListener listener)
Removes a RemoteListener to no longer be notified about
RemoteEvents received by this RTPTranslatorImpl.
|
void |
removeSendStreamListener(StreamRTPManager streamRTPManager,
javax.media.rtp.SendStreamListener listener)
Not implemented because there are currently no uses of the underlying
functionality.
|
void |
removeSessionListener(StreamRTPManager streamRTPManager,
javax.media.rtp.SessionListener listener)
Not implemented because there are currently no uses of the underlying
functionality.
|
void |
setLocalSSRC(long localSSRC)
Sets the local SSRC for this RTPTranslatorImpl.
|
void |
setSSRCFactory(SSRCFactory ssrcFactory)
Sets the SSRCFactory which is to generate new synchronization
source (SSRC) identifiers.
|
void |
update(javax.media.rtp.event.ReceiveStreamEvent event)
Notifies this ReceiveStreamListener about a specific event
related to a ReceiveStream.
|
(package private) boolean |
willWrite(StreamRTPManagerDesc source,
RawPacket pkt,
StreamRTPManagerDesc destination,
boolean data)
Notifies this RTPTranslator that a buffer from a
source will be written into a destination.
|
boolean |
writeControlPayload(Payload controlPayload,
MediaStream destination)
Writes an RTCPFeedbackMessage into a destination identified by
a specific MediaStream.
|
addWriteFilter, getWriteFilters, removeWriteFilter, willWrite, willWrite
public RTPTranslatorImpl()
static void logRTCP(java.lang.Object obj, java.lang.String methodName, byte[] buf, int off, int len)
LOGGER
for debugging
purposes.obj
- the object which is the source of the log requestmethodName
- the name of the method on obj which is the
source of the log requestbuf
- the bytes which (possibly) represent an RTCP
packet to be logged for debugging purposesoff
- the position within buf at which the valid data
beginslen
- the number of bytes in buf which constitute the valid
datapublic void addFormat(StreamRTPManager streamRTPManager, javax.media.Format format, int payloadType)
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 formatpublic void addReceiveStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.ReceiveStreamListener listener)
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
streamRTPManagerpublic void addRemoteListener(StreamRTPManager streamRTPManager, javax.media.rtp.RemoteListener listener)
streamRTPManager
- the StreamRTPManager which is requesting
the addition of the specified RemoteListenerlistener
- the RemoteListener to be notified about
RemoteEvents received by this RTPTranslatorImplpublic void addSendStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.SendStreamListener listener)
public void addSessionListener(StreamRTPManager streamRTPManager, javax.media.rtp.SessionListener listener)
void closeSendStream(SendStreamDesc sendStreamDesc)
sendStreamDesc
- a SendStreamDesc instance that specifies
the SendStream to be closedpublic javax.media.rtp.SendStream createSendStream(StreamRTPManager streamRTPManager, javax.media.protocol.DataSource dataSource, int streamIndex) throws java.io.IOException, javax.media.format.UnsupportedFormatException
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 createdjava.io.IOException
- if an error occurs during the execution of
RTPManager.createSendStream(DataSource, int)
javax.media.format.UnsupportedFormatException
- if an error occurs during the
execution of RTPManager.createSendStream(DataSource, int)int didRead(PushSourceStreamDesc streamDesc, byte[] buf, int off, int len, int flags) throws java.io.IOException
streamDesc
- a PushSourceStreamDesc which identifies the
peer from which an RTP or RTCP packet has been receivedbuf
- the buffer which contains the bytes of the received RTP or
RTCP packetoff
- the zero-based index in buf at which the bytes of the
received RTP or RTCP packet beginlen
- the number of bytes in buf beginning at off
which represent the received RTP or RTCP packetflags
- Buffer.FLAG_XXXjava.io.IOException
- if an I/O error occurs while the method processes the
specified RTP or RTCP packetpublic void dispose()
dispose
in interface RTPTranslator
public void dispose(StreamRTPManager streamRTPManager)
public StreamRTPManager findStreamRTPManagerByReceiveSSRC(int receiveSSRC)
StreamRTPManager
which receives a specific SSRC.findStreamRTPManagerByReceiveSSRC
in interface RTPTranslator
receiveSSRC
- the SSRC of the RTP stream received by the
StreamRTPManager
to be returnedStreamRTPManager
which receives receiveSSRC
of null
public java.lang.Object getControl(StreamRTPManager streamRTPManager, java.lang.String controlType)
Controls.getControl(String)
on the internal/underlying
RTPManager.streamRTPManager
- ignoredcontrolType
- public javax.media.rtp.GlobalReceptionStats getGlobalReceptionStats(StreamRTPManager streamRTPManager)
RTPManager.getGlobalReceptionStats()
on the
internal/underlying RTPManager.streamRTPManager
- ignoredpublic javax.media.rtp.GlobalTransmissionStats getGlobalTransmissionStats(StreamRTPManager streamRTPManager)
RTPManager.getGlobalTransmissionStats()
on the
internal/underlying RTPManager.streamRTPManager
- ignoredpublic long getLocalSSRC(StreamRTPManager streamRTPManager)
RTPSessionMgr.getLocalSSRC()
on the internal/underlying
RTPSessionMgr.streamRTPManager
- ignoredpublic java.util.Vector<javax.media.rtp.ReceiveStream> getReceiveStreams(StreamRTPManager streamRTPManager)
streamRTPManager
- the StreamRTPManager to which the
returned ReceiveStreams are to be relatedpublic RTCPFeedbackMessageSender getRtcpFeedbackMessageSender()
public java.util.Vector<javax.media.rtp.SendStream> getSendStreams(StreamRTPManager streamRTPManager)
streamRTPManager
- the StreamRTPManager to which the
returned SendStreams are to be relatedpublic java.util.List<StreamRTPManager> getStreamRTPManagers()
getStreamRTPManagers
in interface RTPTranslator
public void initialize(StreamRTPManager streamRTPManager, javax.media.rtp.RTPConnector connector)
public void removeReceiveStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.ReceiveStreamListener listener)
addReceiveStreamListener(StreamRTPManager,
ReceiveStreamListener)
does not add equal
ReceiveStreamListeners, a single removal is enough to reverse
multiple additions of equal ReceiveStreamListeners.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
streamRTPManagerpublic void removeRemoteListener(StreamRTPManager streamRTPManager, javax.media.rtp.RemoteListener listener)
streamRTPManager
- the StreamRTPManager which is requesting
the removal of the specified RemoteListenerlistener
- the RemoteListener to no longer be notified
about RemoteEvents received by this RTPTranslatorImplpublic void removeSendStreamListener(StreamRTPManager streamRTPManager, javax.media.rtp.SendStreamListener listener)
addSendStreamListener(StreamRTPManager, SendStreamListener)
is
not implemented for the same reason.)public void removeSessionListener(StreamRTPManager streamRTPManager, javax.media.rtp.SessionListener listener)
addSessionListener(StreamRTPManager, SessionListener)
is not
implemented for the same reason.)public void setLocalSSRC(long localSSRC)
localSSRC
- the SSRC to set.public void setSSRCFactory(SSRCFactory ssrcFactory)
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) identifierspublic void update(javax.media.rtp.event.ReceiveStreamEvent event)
update
in interface javax.media.rtp.ReceiveStreamListener
event
- a ReceiveStreamEvent which contains the specifics
of the event this ReceiveStreamListener is being notified aboutReceiveStreamListener.update(ReceiveStreamEvent)
boolean willWrite(StreamRTPManagerDesc source, RawPacket pkt, StreamRTPManagerDesc destination, boolean data)
source
- the source of bufferpkt
- the packet from the source which are to be written into the
destinationdestination
- the destination into which buffer is to be
writtendata
- true for data/RTP or false for control/RTCPpublic boolean writeControlPayload(Payload controlPayload, MediaStream destination)
controlPayload
- destination
- public net.sf.fmj.media.rtp.SSRCCache getSSRCCache()
getSSRCCache
in interface RTPTranslator
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.