rtpi
Class Rtpi

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--rtpi.Rtpi

public final class Rtpi
extends java.lang.Thread
implements ReliableRecipient, Sleeper, TransportRecipient

This class represents the main API to the RTP/I library. It also provides the functionality to fragment oversized ADUs and to handle RTCP/I.

Author:
Martin Mauve

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Rtpi(Reliable reliabilityService, RtpiSourceInfo localParticipant, Transport rtcpiTransport, int maxControlBandwidth, boolean useApplicationLevelNames)
          Construct the Rtpi object.
 
Method Summary
 void activateSubcomponent(long subID)
          This should be called by the local application on an existing (that is: previously registered) sub-component as soon as this sub-component is locally needed to display the interactive medium to the user.
 void addSubcomponent(long subID, byte[] appName, boolean active)
          This should be called by the application to indicate that it is now interested in a certain subcomponent (e.g. keeps track of its state).
 void connectionClosed()
          This is the implementation of the connectionClosed method from the ReliableRecipient (package rtpi.reliability) and the TransportRecipient (package rtpi.transport) interfaces.
 void deactivateSubcomponent(long subID)
          This should be called by the local application on an existing (that is: previously registered) and activated sub-component as soon as this sub-component is no longer needed to display the interactive medium locally to the user.
 int getCombinedHeaderSize()
          This returns the size of the combined RTP/I and reliability headers.
 void joinGroup()
          This joins both, the RTP/I and the RTCP/I groups.
 void leaveGroup()
          Leave both the RTP/I and RTCP/I groups.
 void quit()
          This terminates Rtpi.
 void receiveRtpiAdu(java.util.LinkedList adu)
          This is the implementation of receiveRtpiAdu from the ReliableRecipient interface. (package rtpi.reliability).
 void receiveTransportPacket(TransportPacket packet)
          This method is called by the transport instance that is responsible for RTCP/I as soon as a packet has been received.
 void removeSubcomponent(long subID)
          This should be called by the local application to indicate that it is no longer interested in a certain subcomponent.
 void rtpiAduLost(int participantID, long subID, int type, int sequenceNumber, int timestamp)
          This is the implementation of rtpiAduLost from the ReliableRecipient interface. (package rtpi.reliability).
 void rtpiCouldNotRecover(int participantID, long subID, int type, int sequenceNumber, int timestamp)
          This is the implementation of rtpiCouldNotRecover from the ReliableRecipient interface. (package rtpi.reliability).
 void run()
           
 void setRtpiRecipient(RtpiRecipient r)
          This sets the recipient of incoming ADUs and notifications.
 void transmitDeltaState(RtpiDeltaState deltaState)
          Transmit an RtpiDeltaState.
 void transmitEvent(RtpiEvent event)
          Transmit an RtpiEvent.
 void transmitState(RtpiState state)
          Transmit an RtpiState.
 void transmitStateQuery(RtpiStateQuery query)
          Transmit an RtpiStateQuery.
 void wakeUp()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rtpi

public Rtpi(Reliable reliabilityService,
            RtpiSourceInfo localParticipant,
            Transport rtcpiTransport,
            int maxControlBandwidth,
            boolean useApplicationLevelNames)
Construct the Rtpi object.
Parameters:
reliabilityService - The reliability service that is used to transmit the data part of RTP/I. The Rtpi instance will automatically subscribe as a recipient to the service. The application is responsible for setting the QoS parameters of the reliability service. Rtpi will forward any messages of lost ADUs to the application.
localParticipant - The description of the local participant. This information is used by RTCP/I to construct SDES packets.
rtcpiTransport - The transport instance over which RTCP/I packets are to be transmitted. Rtpi will automatically subscribe as a recipient to this Transport instance.
maxControlBandwidth - The maximum amount of bandwidth available for RTCP/I packets for the whole session (all participants). This value MUST be the same for all participants in a session. The value is given in bytes per second.
useApplicationLevelNames - If set to true, application level names are used. If set to false application level names will not be used. This value MUST be the same for all participants of a session.
Method Detail

getCombinedHeaderSize

public int getCombinedHeaderSize()
This returns the size of the combined RTP/I and reliability headers.
Returns:
The header size.

run

public void run()
Overrides:
run in class java.lang.Thread

quit

public void quit()
This terminates Rtpi. No RTCP/I BYE will be sent.

setRtpiRecipient

public void setRtpiRecipient(RtpiRecipient r)
This sets the recipient of incoming ADUs and notifications.
Parameters:
r - The recipient.

joinGroup

public void joinGroup()
This joins both, the RTP/I and the RTCP/I groups. If these groups were joined and left previously, then all remote participants as well as local and remote sub-components are cleared.

leaveGroup

public void leaveGroup()
Leave both the RTP/I and RTCP/I groups. After leaving it may be joined later on. However, this will delete all information about sub-components (remote and local) as well as about all remote participants.

addSubcomponent

public void addSubcomponent(long subID,
                            byte[] appName,
                            boolean active)
                     throws IllegalValueException
This should be called by the application to indicate that it is now interested in a certain subcomponent (e.g. keeps track of its state). The name must be non-null if the Rtpi instance was created with useApplicationLevelNames set to true. It must be null if the Rtpi instance was created with useApplicationLevelNames set to false.
Parameters:
subID - The (unique) ID of this sub-component.
appName - The application-level name of this sub-component.
active - Indicates whether this sub-component is active or not (i.e. used to display the medium to the user)

removeSubcomponent

public void removeSubcomponent(long subID)
This should be called by the local application to indicate that it is no longer interested in a certain subcomponent.
Parameters:
subID - The (unique) ID of this sub-component.

activateSubcomponent

public void activateSubcomponent(long subID)
This should be called by the local application on an existing (that is: previously registered) sub-component as soon as this sub-component is locally needed to display the interactive medium to the user.
Parameters:
subID - The (unique) ID of this sub-component.

deactivateSubcomponent

public void deactivateSubcomponent(long subID)
This should be called by the local application on an existing (that is: previously registered) and activated sub-component as soon as this sub-component is no longer needed to display the interactive medium locally to the user.
Parameters:
subID - The (unique) ID of this sub-component.

transmitState

public void transmitState(RtpiState state)
Transmit an RtpiState.
Parameters:
state - The RtpiState which should be transmitted.

transmitDeltaState

public void transmitDeltaState(RtpiDeltaState deltaState)
Transmit an RtpiDeltaState.
Parameters:
deltaState - The RtpiDeltaState which should be transmitted.

transmitEvent

public void transmitEvent(RtpiEvent event)
Transmit an RtpiEvent.
Parameters:
event - The RtpiEvent which should be transmitted.

transmitStateQuery

public void transmitStateQuery(RtpiStateQuery query)
Transmit an RtpiStateQuery.
Parameters:
query - The RtpiStateQuery which should be transmitted.

receiveRtpiAdu

public void receiveRtpiAdu(java.util.LinkedList adu)
This is the implementation of receiveRtpiAdu from the ReliableRecipient interface. (package rtpi.reliability). It is called when an ADU is received by the reliability service.
Specified by:
receiveRtpiAdu in interface ReliableRecipient
Parameters:
adu - The RTP/I ADU which has been received.

rtpiAduLost

public void rtpiAduLost(int participantID,
                        long subID,
                        int type,
                        int sequenceNumber,
                        int timestamp)
This is the implementation of rtpiAduLost from the ReliableRecipient interface. (package rtpi.reliability). The call is directly forwarded to the recipient registered with this Rtpi object.
Specified by:
rtpiAduLost in interface ReliableRecipient
Parameters:
participantID - The ID of the sender of the lost ADU.
subID - The ID of the subcomponent the lost ADU refers to.
type - The type of the lost ADU.
sequenceNumber - the sequenceNumber of the lost ADU.
timestamp - the timestamp of the lost ADU.

rtpiCouldNotRecover

public void rtpiCouldNotRecover(int participantID,
                                long subID,
                                int type,
                                int sequenceNumber,
                                int timestamp)
This is the implementation of rtpiCouldNotRecover from the ReliableRecipient interface. (package rtpi.reliability). The call is directly forwarded to the recipient registered with this Rtpi object.
Specified by:
rtpiCouldNotRecover in interface ReliableRecipient
Parameters:
participantID - The ID of the sender of the lost ADU.
subID - The ID of the subcomponent the lost ADU refers to.
type - The type of the lost ADU.
sequenceNumber - the sequenceNumber of the lost ADU.
timestamp - the timestamp of the lost ADU.

connectionClosed

public void connectionClosed()
This is the implementation of the connectionClosed method from the ReliableRecipient (package rtpi.reliability) and the TransportRecipient (package rtpi.transport) interfaces. These messages are directly forwarded to the recipient registered with this Rtpi object.
Specified by:
connectionClosed in interface ReliableRecipient

receiveTransportPacket

public void receiveTransportPacket(TransportPacket packet)
This method is called by the transport instance that is responsible for RTCP/I as soon as a packet has been received.
Specified by:
receiveTransportPacket in interface TransportRecipient
Parameters:
packet - The received transport packet.

wakeUp

public void wakeUp()
Specified by:
wakeUp in interface Sleeper