cnrg.itx.datax.devices
Class RTPPacketFactory

java.lang.Object
  |
  +--cnrg.itx.datax.devices.RTPPacketFactory

class RTPPacketFactory
extends java.lang.Object

Class for implementing the factory that creates RTP packets for sending over the network.


Field Summary
private  RTPHeader header
          Attribute for storing the RTP header for this factory.
private  RTPPacket packet
          Attribute for storing a RTP packet for this factory.
private  short sequence
          Attribute for storing the previous RTP packet's sequence number.
 
Constructor Summary
RTPPacketFactory()
          Default constructor for the factory.
 
Method Summary
 byte[] createRTPPacket(byte[] data)
          Method to create an RTP packet from a data packet.
 RTPPacket getRTPPacket(byte[] rtpPacket)
          Method to retrieve the RTPPacket object from an RTP packet.
 int getSequenceNumber()
          Method to get the sequence number
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

header

private RTPHeader header
Attribute for storing the RTP header for this factory. This RTP header can be initialized once and reused to create subsequent RTP packets. Only the sequence number and the timestamp need to be changed for each packet.

packet

private RTPPacket packet
Attribute for storing a RTP packet for this factory. This RTP packet can be reused to make make a RTP byte array for each data packet.

sequence

private short sequence
Attribute for storing the previous RTP packet's sequence number.
Constructor Detail

RTPPacketFactory

public RTPPacketFactory()
Default constructor for the factory. This creates a default RTP header.
Method Detail

createRTPPacket

public byte[] createRTPPacket(byte[] data)
Method to create an RTP packet from a data packet. This method will put in the required RTP header and insert the data after it.
Parameters:
data - the data to be sent as part of the RTP packet
Returns:
byte[] the RTP version of the packet

getRTPPacket

public RTPPacket getRTPPacket(byte[] rtpPacket)
Method to retrieve the RTPPacket object from an RTP packet.
Parameters:
rtpPacket - the RTP packet byte array with the header
Returns:
RTPPacket the RTPPacket object

getSequenceNumber

public int getSequenceNumber()
Method to get the sequence number
Returns:
int the sequence number