jlibrtp
Class DataFrame

java.lang.Object
  extended by jlibrtp.DataFrame

public class DataFrame
extends java.lang.Object

Data structure to hold a complete frame if frame reconstruction is enabled, or the data from an individual packet if it is not It also contains most of the data from the individual packets that it is based on.

Author:
Arne Kepp

Method Summary
 int complete()
          Checks whether the difference in sequence numbers corresponds to the number of packets received for the current timestamp, and whether this value corresponds to the expected number of packets.
 long[] csrcs()
          The SSRCs that contributed to this frame
 byte[] getConcatenatedData()
          Returns a concatenated version of the data from getData() It ignores missing sequence numbers, but then isComplete() will return false provided that RTPAppIntf.frameSize() provides a non-negative number for this payload type.
 byte[][] getData()
          Returns a two dimensial array where the first dimension represents individual packets, from which the frame is made up, in order of increasing sequence number.
 boolean marked()
          Returns true if any packet in the frame was marked.
 boolean[] marks()
          Returns an array whose values, for the same index, correpond to whether the data was marked or not.
 int payloadType()
          Returns the payload type of the packets
 long rtpTimestamp()
          Returns the RTP timestamp of all the packets in the frame.
 int[] sequenceNumbers()
          Returns an array whose values, for the same index, correpond to the sequence number of the packet from which the data came.
 long ssrc()
          The SSRC associated with this frame.
 long timestamp()
          If two SR packet have been received jlibrtp will attempt to calculate the local UNIX timestamp (in milliseconds) of all packets received.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getData

public byte[][] getData()
Returns a two dimensial array where the first dimension represents individual packets, from which the frame is made up, in order of increasing sequence number. These indeces can be matched to the sequence numbers returned by sequenceNumbers().

Returns:
2-dim array with raw data from packets

getConcatenatedData

public byte[] getConcatenatedData()
Returns a concatenated version of the data from getData() It ignores missing sequence numbers, but then isComplete() will return false provided that RTPAppIntf.frameSize() provides a non-negative number for this payload type.

Returns:
byte[] with all the data concatenated

timestamp

public long timestamp()
If two SR packet have been received jlibrtp will attempt to calculate the local UNIX timestamp (in milliseconds) of all packets received. This value should ideally correspond to the local time when the SSRC sent the packet. Note that the source may not be reliable. Returns -1 if less than two SRs have been received

Returns:
the UNIX timestamp, similar to System.currentTimeMillis() or -1;

rtpTimestamp

public long rtpTimestamp()
Returns the RTP timestamp of all the packets in the frame.

Returns:
unmodified RTP timestamp

payloadType

public int payloadType()
Returns the payload type of the packets

Returns:
the payload type of the packets

sequenceNumbers

public int[] sequenceNumbers()
Returns an array whose values, for the same index, correpond to the sequence number of the packet from which the data came. This information can be valuable in conjunction with getData(), to identify what parts of a frame are missing.

Returns:
array with sequence numbers

marks

public boolean[] marks()
Returns an array whose values, for the same index, correpond to whether the data was marked or not. This information can be valuable in conjunction with getData().

Returns:
array of booleans

marked

public boolean marked()
Returns true if any packet in the frame was marked. This function should be used if all your frames fit into single packets.

Returns:
true if any packet was marked, false otherwise

ssrc

public long ssrc()
The SSRC associated with this frame.

Returns:
the ssrc that created this frame

csrcs

public long[] csrcs()
The SSRCs that contributed to this frame

Returns:
an array of contributing SSRCs, or null

complete

public int complete()
Checks whether the difference in sequence numbers corresponds to the number of packets received for the current timestamp, and whether this value corresponds to the expected number of packets.

Returns:
true if the right number of packets make up the frame