|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.rtp.RTPManager
The interface implemented by the RTPManager. This is the starting point for creating, maintaining and closing an RTP session.
1. Unicast Session
The following code fragment illustrates how to create a unicast
session:
import java.net.*; import javax.media.rtp.*; // create the RTP Manager RTPManager rtpManager = RTPManager.newInstance(); // create the local endpoint for the local interface on // any local port SessionAddress localAddress = new SessionAddress(); // initialize the RTPManager rtpManager.initialize( localAddress); // add the ReceiveStreamListener if you need to receive data // and do other application specific stuff // ... // specify the remote endpoint of this unicast session // the address string and port numbers in the following lines // need to be replaced with your values. InetAddress ipAddress = InetAddress.getByName( "168.1.2.3"); SessionAddress remoteAddress = new SessionAddress( ipAddress, 3000); // open the connection rtpManager.addTarget( remoteAddress); // create a send stream for the output data source of a processor // and start it DataSource dataOutput = createDataSource(); SendStream sendStream = rtpSession.createSendStream( dataOutput, 1); sendStream.start(); // send data and do other application specific stuff, // ... // close the connection if no longer needed. rtpManager.removeTarget( remoteAddress, "client disconnected."); // call dispose at the end of the life-cycle of this RTPManager so // it is prepared to be garbage-collected. rtpManager.dispose();2. Multi-Unicast Session
addTarget( remoteAddress2); addTarget( remoteAddress3);3. Multicast Session
//... // create a multicast address for 224.1.1.0 and ports 3000/3001 IPAddress ipAddress = InetAddress.getByName( "224.1.1.0"); SessionAddress multiAddress = new SessionAddress( ipAddress, 3000); // initialize the RTPManager rtpManager.initialize( multiAddress); // add the target rtpManager.addTarget( multiAddress); // ...
Constructor Summary | |
RTPManager()
|
Method Summary | |
abstract void |
addFormat(Format format,
int payload)
This method is used to add a dynamic payload to format mapping to the RTPManager. |
abstract void |
addReceiveStreamListener(ReceiveStreamListener listener)
Adds a ReceiveStreamListener. |
abstract void |
addRemoteListener(RemoteListener listener)
Adds a RemoteListener to the session. |
abstract void |
addSendStreamListener(SendStreamListener listener)
Adds a SendStreamListener. |
abstract void |
addSessionListener(SessionListener listener)
Adds a SessionListener. |
abstract void |
addTarget(SessionAddress remoteAddress)
This method opens the session, causing RTCP reports to be generated and callbacks to be made through the SessionListener interface. |
abstract SendStream |
createSendStream(DataSource dataSource,
int streamIndex)
This method is used to create a sending stream within the RTP session. |
abstract void |
dispose()
Releases all objects allocated in the course of the session and prepares the RTPManager to be garbage-collected. |
abstract java.util.Vector |
getActiveParticipants()
Returns a vector of all the active (data sending) participants. |
abstract java.util.Vector |
getAllParticipants()
Returns all the participants of this session. |
abstract GlobalReceptionStats |
getGlobalReceptionStats()
This method will provide access to overall data and control messsage reception statistics for this session. |
abstract GlobalTransmissionStats |
getGlobalTransmissionStats()
This method will provide access to overall data and control messsage transmission statistics for this session. |
abstract LocalParticipant |
getLocalParticipant()
Retrieves the local participant. |
abstract java.util.Vector |
getPassiveParticipants()
Returns all the passive participants. |
abstract java.util.Vector |
getReceiveStreams()
Returns the ReceiveStreams created by the RTPManager. |
abstract java.util.Vector |
getRemoteParticipants()
Returns a Vector of all the remote participants in the session.This vector is simply a snapshot of the current state in the RTPManager. |
static java.util.Vector |
getRTPManagerList()
Build a list of RTPManager implementation classes. |
abstract java.util.Vector |
getSendStreams()
Returns the SendStreams created by the RTPManager. |
abstract void |
initialize(RTPConnector connector)
Initializes the session. |
abstract void |
initialize(SessionAddress localAddress)
Initializes the session. |
abstract void |
initialize(SessionAddress[] localAddresses,
SourceDescription[] sourceDescription,
double rtcpBandwidthFraction,
double rtcpSenderBandwidthFraction,
EncryptionInfo encryptionInfo)
Initializes the session. |
static RTPManager |
newInstance()
Create an RTPManager object for the underlying
implementation class. |
abstract void |
removeReceiveStreamListener(ReceiveStreamListener listener)
Removes a ReceiveStreamListener. |
abstract void |
removeRemoteListener(RemoteListener listener)
Removes a RemoteListener. |
abstract void |
removeSendStreamListener(SendStreamListener listener)
Removes a SendStreamListener. |
abstract void |
removeSessionListener(SessionListener listener)
Removes a SessionListener. |
abstract void |
removeTarget(SessionAddress remoteAddress,
java.lang.String reason)
Closes all open streams associated with the endpoint defined by remoteAddress. |
abstract void |
removeTargets(java.lang.String reason)
Closes the open streams associated with all remote endpoints that have been added previously by subsequent addTarget() calls. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public RTPManager()
Method Detail |
public abstract void addFormat(Format format, int payload)
format
- The Format to be associated with this dynamic
payload number.payload
- The RTP payload numberFormat
public abstract void addReceiveStreamListener(ReceiveStreamListener listener)
public abstract void addRemoteListener(RemoteListener listener)
public abstract void addSendStreamListener(SendStreamListener listener)
public abstract void addSessionListener(SessionListener listener)
public abstract void removeTarget(SessionAddress remoteAddress, java.lang.String reason) throws InvalidSessionAddressException
remoteAddress
- The RTP session address of a remote end
point for this session. i.e. the IP address/port of a remote
hostreason
- A string that RTCP will send out to other
participants as the reason the local participant has quit the
session.This RTCP packet will go out with the default SSRC of the
session. If supplied as null, a default reason will be supplied
by the RTPManager.
public abstract void removeTargets(java.lang.String reason)
reason
- A string that RTCP will send out to other
participants as the reason the local participant has quit the
session.This RTCP packet will go out with the default SSRC of the
session. If supplied as null, a default reason will be supplied
by the RTPManager. public abstract SendStream createSendStream(DataSource dataSource, int streamIndex) throws UnsupportedFormatException, java.io.IOException
dataSource
- This is the PushOutputDataSource or
PullOutputDataSource which is the output data source of the
Processor. This data source may contain more than one
stream. The stream which is used in creating this RTP
stream is specified in the next parameter of stream.streamIndex
- The index of the sourcestream from which
data is sent out on this RTP stream. An index of 1 would indicate the first
sourcestream of this data source should be used to create the RTP
stream. If the index is set to zero, it would indicate a RTP
mixer operation is desired. i.e. all the streams of this
data source must be mixed into one single stream from one single
SSRC. public abstract void dispose()
public abstract java.util.Vector getActiveParticipants()
public abstract java.util.Vector getAllParticipants()
public abstract GlobalReceptionStats getGlobalReceptionStats()
public abstract GlobalTransmissionStats getGlobalTransmissionStats()
public abstract LocalParticipant getLocalParticipant()
public abstract java.util.Vector getPassiveParticipants()
public abstract java.util.Vector getReceiveStreams()
public abstract java.util.Vector getRemoteParticipants()
public abstract java.util.Vector getSendStreams()
public abstract void initialize(SessionAddress localAddress) throws InvalidSessionAddressException, java.io.IOException
localAddress
- Encapsulates the *local* control and data
addresses to be used for the session. If either InetAddress
contained in this parameter is null, a default local address
will be chosen. The ports do not necessarily need to be specified
(i.e. they may be the ANY_PORT constant); the RTPManager will pick
appropriate ports in that case. If the session joins a multicast group, the localAddress will be ignored. The multicast address will be taken from the addTarget() call.
public abstract void initialize(SessionAddress[] localAddresses, SourceDescription[] sourceDescription, double rtcpBandwidthFraction, double rtcpSenderBandwidthFraction, EncryptionInfo encryptionInfo) throws InvalidSessionAddressException, java.io.IOException
localAddresses
- An array of local session adresses.
In most cases the address will contain a single session address,
but for multi-homed systems (systems with more than one IP interface)
there may be several local adresses specified in this parameter. sourceDescription
- An array of SourceDescription
objects containing information to send in RTCP SDES packets
for the local participant. This information can be changed by
calling setSourceDescription() on the local Participant
object.rtcpBandwidthFraction
- The fraction of the session bandwidth
that the RTPManager must use when sending out RTCP reports.rtcpSenderBandwidthFraction
- The fraction of the
rtcpBandwidthFraction that the RTPManager must use to send out RTCP Sender
reports from the local participant. The remaining fraction of the
rtcp_bw is used for sending out RTCP Receiver reports. encryptionInfo
- the encryption information to be used in
this session.
Note : The rtcpBandwidthFraction is set to zero for a
non-participating observer of this session. In this case
the application will receive both RTP and RTCP messages, but will
not send out any RTCP feedback reports.
This is equivalent to setting the outgoing RTP/RTCP
bandwidth of this application to zero, implying that this
application may NOT send out any data or control streams and can
thus not make a call to createSendStream(). If it does, it will
receive an exception. Further, this application is NOT considered
a Participant since it does not send out any RTCP
information. Consequently, this client will NOT appear in the
list of Participants for this session.Init called a second time or thereafter will return without doing anything, since the session had already been initialized. If parameters to init() are different from before, the user must note that the new parameters will ignored as a result of no action being performed.
public abstract void initialize(RTPConnector connector)
connector
- An implementation of the RTPConnector interface that
allows the developer to connect the RTPManager to any type of transport.
By default, RTP is streamed over UDP. If an RTPConnector is present, the
RTPManager will use the connector's send and receive methods to send or
receive data.
Please note: the methods addTarget, removeTarget and removeTargets cannot
be used in conjunction with an RTPConnector since these tasks will be handled
directly by the connector object.public abstract void addTarget(SessionAddress remoteAddress) throws InvalidSessionAddressException, java.io.IOException
remoteAddress
- The RTP session address of a remote end
point for this session. i.e. the IP address/port of a remote
hostpublic abstract void removeReceiveStreamListener(ReceiveStreamListener listener)
public abstract void removeRemoteListener(RemoteListener listener)
public abstract void removeSendStreamListener(SendStreamListener listener)
public abstract void removeSessionListener(SessionListener listener)
public static RTPManager newInstance()
RTPManager
object for the underlying
implementation class.public static java.util.Vector getRTPManagerList()
RTPManager
implementation classes.
The implemenation class must be named 'RTPSessionMgr' and is
required to extend from javax.media.rtp.RTPManager.
The first name in the list will always be:
media.rtp.RTPSessionMgr
Each additional name looks like:
for everycom.<company>.media.rtp.RTPSessionMgr
<company>
in the
company-list.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |