public class RTPSessionMgr extends RTPManager implements SessionManager
Modifier and Type | Field and Description |
---|---|
protected long |
ssrc |
SSRC_UNSPEC
Constructor and Description |
---|
RTPSessionMgr()
Creates a new RTPManager
|
Modifier and Type | Method and Description |
---|---|
void |
addFormat(Format format,
int payload)
Add a format to the list of supported formats.
|
void |
addPeer(SessionAddress peerAddress)
Add a peer to send RTP data to.
|
void |
addReceiveStreamListener(ReceiveStreamListener listener)
Adds a listener to the list of listeners wanting to be informed when a receive stream is created.
|
void |
addRemoteListener(RemoteListener listener)
Adds a listener to the list of remote listeners.
|
void |
addSendStreamListener(SendStreamListener listener)
Add this listener to the list of listeners wanting to be informed when a send stream is created.
|
void |
addSessionListener(SessionListener listener)
Add this listener to the list of session listeners.
|
void |
addTarget(SessionAddress remoteAddress)
Add a network target to which we'll send our RTP packets.
|
void |
closeSession(java.lang.String reason)
Closes this RTP Session.
|
SendStream |
createSendStream(DataSource dataSource,
int streamIndex)
Creates a send stream used to carry data from a source to some receivers over the network.
|
SendStream |
createSendStream(int ssrc,
DataSource ds,
int streamindex)
Creates a send stream used to carry data from a source to some receivers over the network.
|
void |
dispose()
Called when wishing to quit the RTP session.
|
static boolean |
formatSupported(Format f)
This is a function provided by Sun's implementation, which is not in the API as AFAIK - kenlars99.
|
java.lang.String |
generateCNAME()
Generate a CNAME.
|
long |
generateSSRC()
Generates a Synchronization SouRCe (SSRC) number.
|
java.util.Vector |
getActiveParticipants()
Returns the list of active participants in this RTP session.
|
java.util.Vector |
getAllParticipants()
Returns the list of all participants in this RTP session.
|
int |
getAverageRTCPSize()
Returns the average RTP packet size computed until now.
|
java.lang.Object |
getControl(java.lang.String controlClass)
Get control for the specified type.
|
java.lang.Object[] |
getControls()
Get the list of all controls possible.
|
long |
getDefaultSSRC()
Returns the default SSRC in this RTP session.
|
Format |
getFormat(int payload)
Another function provided by Sun's implementation, not in the spec/API.
|
GlobalReceptionStats |
getGlobalReceptionStats()
Returns the global reception statistics for this RTP session.
|
GlobalTransmissionStats |
getGlobalTransmissionStats()
Returns the global transmission statistics for this RTP session.
|
LocalParticipant |
getLocalParticipant()
Returns the local participant.
|
SessionAddress |
getLocalSessionAddress()
Returns the local session address.
|
int |
getMulticastScope()
Returns the multicast scope.
|
java.util.Vector |
getPassiveParticipants()
Returns the list of passive participants in this RTP session.
|
java.util.Vector |
getPeers()
Returns all the receiver & senders peers we're sending RTP data to.
|
java.util.Vector |
getReceiveStreams()
Returns the list of receive streams in this RTP session.
|
java.util.Vector |
getRemoteParticipants()
Returns the list of remote participants in this RTP session.
|
SessionAddress |
getRemoteSessionAddress()
Returns the remote session address.
|
java.util.Vector |
getSendStreams()
Returns the list of send streams in this RTP session.
|
SessionAddress |
getSessionAddress()
Returns the session address.
|
RTPStream |
getStream(long filterssrc)
Returns the RTPStream corresponding to this SSRC.
|
static Format[] |
getSupportedFormats()
Return the SupportedFormats via RTP
|
protected void |
handleRTCPPacket(byte[] data,
int offset,
int length)
Handles an incoming RTCP packet
|
protected void |
handleRTPPacket(byte[] data,
int offset,
int length)
Handles an incoming RTP packet
|
void |
initialize(RTPConnector connector)
Initializes and starts the RTP Session.
|
void |
initialize(SessionAddress localAddress)
Initializes and starts the RTP Session.
|
void |
initialize(SessionAddress[] localAddresses,
SourceDescription[] sourceDescription,
double rtcpBandwidthFraction,
double rtcpSenderBandwidthFraction,
EncryptionInfo encryptionInfo)
Initializes and starts the RTP Session.
|
int |
initSession(SessionAddress localAddress,
long defaultSSRC,
SourceDescription[] defaultUserDesc,
double rtcp_bw_fraction,
double rtcp_sender_bw_fraction)
Initializes and starts the session.
|
int |
initSession(SessionAddress localAddress,
SourceDescription[] defaultUserDesc,
double rtcp_bw_fraction,
double rtcp_sender_bw_fraction)
Initializes and starts the session.
|
void |
removeAllPeers()
Removes all the peers from this RTP session.
|
void |
removePeer(SessionAddress peerAddress)
Removes a receiver peer from the session.
|
void |
removeReceiveStreamListener(ReceiveStreamListener listener)
Removes this listener from the list of listeners wanting to be be informed
of the creation of new receive streams.
|
void |
removeRemoteListener(RemoteListener listener)
Removes this listener from the list of remote listeners.
|
void |
removeSendStreamListener(SendStreamListener listener)
Removes this listener from the list of listeners wanting to be informed of
the creation of send streams.
|
void |
removeSessionListener(SessionListener listener)
Removes this listener from the list of session listeners.
|
void |
removeTarget(SessionAddress remoteAddress,
java.lang.String reason)
Remove a network target .
|
void |
removeTargets(java.lang.String reason)
Remove a network target .
|
void |
RTPPacketSent(long time,
int size)
Sort of callback method called by RTPSendStreams to inform the RTPSessionManager they're linked to
that an RTP packet has been sent by the local participant.
|
void |
sendRTCPPacket()
Sends an RTCP packet, and schedules the next one
|
void |
setMulticastScope(int multicastScope)
Sets the multicast scope.
|
void |
start()
Starts the sending of RTCP packets
|
int |
startSession(int mcastScope,
EncryptionInfo encryptionInfo)
Starts a session.
|
int |
startSession(SessionAddress destAddress,
int mcastScope,
EncryptionInfo encryptionInfo)
Starts a session.
|
int |
startSession(SessionAddress localReceiverAddress,
SessionAddress localSenderAddress,
SessionAddress remoteReceiverAddress,
EncryptionInfo encryptionInfo)
Starts a session.
|
getRTPManagerList, newInstance
public static boolean formatSupported(Format f)
f
- the format which we want to testpublic static Format[] getSupportedFormats()
public Format getFormat(int payload)
public void addFormat(Format format, int payload)
addFormat
in interface SessionManager
addFormat
in class RTPManager
format
- format to addpayload
- type of payload corresponding to this formatpublic void addReceiveStreamListener(ReceiveStreamListener listener)
addReceiveStreamListener
in interface SessionManager
addReceiveStreamListener
in class RTPManager
listener
- the listener to addpublic void addRemoteListener(RemoteListener listener)
addRemoteListener
in interface SessionManager
addRemoteListener
in class RTPManager
listener
- listener to addpublic void addSendStreamListener(SendStreamListener listener)
addSendStreamListener
in interface SessionManager
addSendStreamListener
in class RTPManager
listener
- the listener to addpublic void addSessionListener(SessionListener listener)
addSessionListener
in interface SessionManager
addSessionListener
in class RTPManager
listener
- listener to addpublic void removeReceiveStreamListener(ReceiveStreamListener listener)
removeReceiveStreamListener
in interface SessionManager
removeReceiveStreamListener
in class RTPManager
listener
- listener to removepublic void removeRemoteListener(RemoteListener listener)
removeRemoteListener
in interface SessionManager
removeRemoteListener
in class RTPManager
listener
- listener to removepublic void removeSendStreamListener(SendStreamListener listener)
removeSendStreamListener
in interface SessionManager
removeSendStreamListener
in class RTPManager
listener
- listener to removepublic void removeSessionListener(SessionListener listener)
removeSessionListener
in interface SessionManager
removeSessionListener
in class RTPManager
listener
- listener to removepublic java.util.Vector getActiveParticipants()
getActiveParticipants
in interface SessionManager
getActiveParticipants
in class RTPManager
public java.util.Vector getAllParticipants()
getAllParticipants
in interface SessionManager
getAllParticipants
in class RTPManager
public LocalParticipant getLocalParticipant()
getLocalParticipant
in interface SessionManager
getLocalParticipant
in class RTPManager
public java.util.Vector getPassiveParticipants()
getPassiveParticipants
in interface SessionManager
getPassiveParticipants
in class RTPManager
public java.util.Vector getRemoteParticipants()
getRemoteParticipants
in interface SessionManager
getRemoteParticipants
in class RTPManager
public GlobalReceptionStats getGlobalReceptionStats()
getGlobalReceptionStats
in interface SessionManager
getGlobalReceptionStats
in class RTPManager
public GlobalTransmissionStats getGlobalTransmissionStats()
getGlobalTransmissionStats
in interface SessionManager
getGlobalTransmissionStats
in class RTPManager
public java.util.Vector getReceiveStreams()
getReceiveStreams
in interface SessionManager
getReceiveStreams
in class RTPManager
public java.util.Vector getSendStreams()
getSendStreams
in interface SessionManager
getSendStreams
in class RTPManager
public void initialize(SessionAddress localAddress) throws java.io.IOException
initialize
in class RTPManager
localAddress
- the local addressjava.io.IOException
- I/O Exceptionpublic void initialize(SessionAddress[] localAddresses, SourceDescription[] sourceDescription, double rtcpBandwidthFraction, double rtcpSenderBandwidthFraction, EncryptionInfo encryptionInfo)
initialize
in class RTPManager
localAddresses
- the local addresssourceDescription
- the source description to be used when sending SDES reportsrtcpBandwidthFraction
- the bandwidth fraction allocated for RTCP trafficrtcpSenderBandwidthFraction
- the RTCP bandwidth fraction allocated for sendersencryptionInfo
- Encryption information - UNUSED at the momentpublic void addTarget(SessionAddress remoteAddress) throws java.io.IOException
addTarget
in class RTPManager
remoteAddress
- remote address (unicast or multicast) to which we want to send our RTP packetsjava.io.IOException
- I/O Exceptionpublic void initialize(RTPConnector connector)
initialize
in class RTPManager
connector
- the RTP connector used to retrieve the control & data streamspublic void removeTarget(SessionAddress remoteAddress, java.lang.String reason)
removeTarget
in class RTPManager
remoteAddress
- remote address (unicast or multicast) to which we want to send our RTP packetsreason
- reason for which we remove this target (used in the RTCP BYE packet following this call)public void removeTargets(java.lang.String reason)
removeTargets
in class RTPManager
reason
- reason for which we remove this target (used in the RTCP BYE packet following this call)public SendStream createSendStream(DataSource dataSource, int streamIndex) throws UnsupportedFormatException, java.io.IOException
createSendStream
in interface SessionManager
createSendStream
in class RTPManager
dataSource
- the datasource producing the data to sendstreamIndex
- the index of the stream in the datasource's streams tableUnsupportedFormatException
- thrown if the datasource's stream only outputs formats which aren't supportedjava.io.IOException
- I/O Exception thrown in case of problem with streamspublic void dispose()
dispose
in class RTPManager
public java.lang.Object getControl(java.lang.String controlClass)
getControl
in interface Controls
controlClass
- the control classpublic java.lang.Object[] getControls()
getControls
in interface Controls
protected void handleRTPPacket(byte[] data, int offset, int length)
data
- The raw packet dataoffset
- The packet offset after which we must start investigatinglength
- The total packet lengthprotected void handleRTCPPacket(byte[] data, int offset, int length)
data
- The packet dataoffset
- The packet offsetlength
- The packet lengthpublic int initSession(SessionAddress localAddress, long defaultSSRC, SourceDescription[] defaultUserDesc, double rtcp_bw_fraction, double rtcp_sender_bw_fraction)
initSession
in interface SessionManager
localAddress
- the local addressdefaultSSRC
- the default SSRC. UNUSED.defaultUserDesc
- the default SDESrtcp_bw_fraction
- the bandwidth fraction allocated for RTCP trafficrtcp_sender_bw_fraction
- the RTCP bandwidth fraction allocated for senderspublic int initSession(SessionAddress localAddress, SourceDescription[] defaultUserDesc, double rtcp_bw_fraction, double rtcp_sender_bw_fraction)
initSession
in interface SessionManager
localAddress
- the local addressdefaultUserDesc
- the default SDESrtcp_bw_fraction
- the bandwidth fraction allocated for RTCP trafficrtcp_sender_bw_fraction
- the RTCP bandwidth fraction allocated for senderspublic int startSession(SessionAddress destAddress, int mcastScope, EncryptionInfo encryptionInfo) throws java.io.IOException
startSession
in interface SessionManager
destAddress
- destination address to add as targetmcastScope
- multicast scope. UNUSED.encryptionInfo
- encryption information. UNUSED.java.io.IOException
- I/O Exceptionpublic int startSession(SessionAddress localReceiverAddress, SessionAddress localSenderAddress, SessionAddress remoteReceiverAddress, EncryptionInfo encryptionInfo) throws java.io.IOException
startSession
in interface SessionManager
localReceiverAddress
- local receiver address. UNUSED.localSenderAddress
- local sender address. UNUSED.remoteReceiverAddress
- remote receiver address to add as targetencryptionInfo
- encryption information. UNUSEDjava.io.IOException
- I/O Exceptionpublic long getDefaultSSRC()
getDefaultSSRC
in interface SessionManager
public RTPStream getStream(long filterssrc)
getStream
in interface SessionManager
filterssrc
- SSRC. UNUSED.public int getMulticastScope()
getMulticastScope
in interface SessionManager
public void setMulticastScope(int multicastScope)
setMulticastScope
in interface SessionManager
multicastScope
- multicast scope. UNUSED.public void closeSession(java.lang.String reason)
closeSession
in interface SessionManager
reason
- Reason why this session is closed (used in the RTCP BYE packet following this call)public java.lang.String generateCNAME()
generateCNAME
in interface SessionManager
public long generateSSRC()
generateSSRC
in interface SessionManager
public SessionAddress getSessionAddress()
getSessionAddress
in interface SessionManager
public SessionAddress getRemoteSessionAddress()
public SessionAddress getLocalSessionAddress()
getLocalSessionAddress
in interface SessionManager
public SendStream createSendStream(int ssrc, DataSource ds, int streamindex) throws UnsupportedFormatException, java.io.IOException
createSendStream
in interface SessionManager
ssrc
- the stream's SSRC. UNUSED.ds
- the datasource producing the data to sendstreamindex
- the index of the stream in the datasource's streams tableUnsupportedFormatException
- thrown if the datasource's stream only outputs formats which aren't supportedjava.io.IOException
- I/O Exception thrown in case of problem with streamspublic int startSession(int mcastScope, EncryptionInfo encryptionInfo)
startSession
in interface SessionManager
mcastScope
- multicast scope. UNUSED.encryptionInfo
- encryption information. UNUSED.public void addPeer(SessionAddress peerAddress) throws java.io.IOException
addPeer
in interface SessionManager
peerAddress
- the remote address used as targetjava.io.IOException
- I/O Exceptionpublic void removePeer(SessionAddress peerAddress)
removePeer
in interface SessionManager
peerAddress
- the peer's address which is used as targetpublic void removeAllPeers()
removeAllPeers
in interface SessionManager
public java.util.Vector getPeers()
getPeers
in interface SessionManager
public void start()
public void sendRTCPPacket()
public void RTPPacketSent(long time, int size)
time
- time when the packet was sentsize
- size of the packet sentpublic int getAverageRTCPSize()