Package org.ow2.clif.probe.rtp
Class ReportPacket
- java.lang.Object
-
- org.ow2.clif.probe.rtp.RTCPPacket
-
- org.ow2.clif.probe.rtp.ReportPacket
-
public class ReportPacket extends RTCPPacket
Create a RTCP SR/RR packet. Cf. RFC 3550 for details about construction of SR/RR packet.- Author:
- Remi Druilhe
-
-
Constructor Summary
Constructors Constructor Description ReportPacket(java.lang.Long ssrc)Constructor for a receiver report.ReportPacket(java.lang.Long ssrc, java.lang.Long rtpTimestamp, java.lang.Long packetCount, java.lang.Long octetCount)Contructor for a sender report.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddReportBlock(java.lang.Long ssrc, java.lang.Integer fractionLost, java.lang.Integer packetsLost, java.lang.Integer cycle, java.lang.Integer maxSeqNum, java.lang.Long jitter, java.lang.Long lsr, java.lang.Long dlsr)Add an item to the report packet.byte[]createPacket()Convert every information of the sender's report header in bytes.static java.lang.LongdecodeSrLswNtpTimestamp(byte[] data, java.lang.Integer offset)Decode LSW Timestamp from a SR report.static java.lang.LongdecodeSrMswNtpTimestamp(byte[] data, java.lang.Integer offset)Decode MSW Timestamp from a SR report.static java.lang.LongdecodeSsrc(byte[] data, java.lang.Integer offset)Decode SSRC from a SR/RR report.static java.lang.LonggenerateLswNtpTimestamp(java.lang.Long time)Decimal part of the NTP Timestamp.static java.lang.LonggenerateMswNtpTimestamp(java.lang.Long time)Floor part of the NTP timestamp.java.lang.IntegergetPacketType()/** Returns the packet type.voidreceiverToSender()Change type of report (201 to 200)voidsenderToReceiver()Change type of report (200 to 201)voidsetNewValues(java.lang.Long rtpTimestamp, java.lang.Long packetCount, java.lang.Long octetCount)To add new value to the SR report.-
Methods inherited from class org.ow2.clif.probe.rtp.RTCPPacket
createRtcpPacket, decodeCount, decodeLength, decodePacketType, decodePadding, decodeTwoComplement, decodeTwoComplement, decodeVersion, getRtcpPackets, packetTypeAvailable
-
-
-
-
Method Detail
-
createPacket
public byte[] createPacket()
Convert every information of the sender's report header in bytes.- Specified by:
createPacketin classRTCPPacket- Returns:
- the header formatted in bytes for sender's report.
-
addReportBlock
public void addReportBlock(java.lang.Long ssrc, java.lang.Integer fractionLost, java.lang.Integer packetsLost, java.lang.Integer cycle, java.lang.Integer maxSeqNum, java.lang.Long jitter, java.lang.Long lsr, java.lang.Long dlsr)Add an item to the report packet.- Parameters:
ssrc- the SSRC associated to the statistics.fractionLost- the fraction lost (cf. RFC 3550 p32).packetsLost- the cumulative number packets lost (cf.RFC 3550 p32).cycle- the number of cycle of the sequence number (cf.RFC 3550 p33).maxSeqNum- the maximum sequence number read (cf.RFC 3550 p33).jitter- the jitter (cf.RFC 3550 p33).lsr- last sender report (cf.RFC 3550 p33).dlsr- delay since last sender report (cf.RFC 3550 p33).
-
receiverToSender
public void receiverToSender()
Change type of report (201 to 200)
-
senderToReceiver
public void senderToReceiver()
Change type of report (200 to 201)
-
generateMswNtpTimestamp
public static java.lang.Long generateMswNtpTimestamp(java.lang.Long time)
Floor part of the NTP timestamp. Calculation of the time since Jan 01, 1900 at midnight. MSW = (24 * 60 * 60) * ((70 * 365) + 17) + time / 1000- Returns:
- the time in seconds.
-
generateLswNtpTimestamp
public static java.lang.Long generateLswNtpTimestamp(java.lang.Long time)
Decimal part of the NTP Timestamp. LSW = E(2^32 * (time & 0xF) / 1000)- Returns:
- the time in seconds.
-
getPacketType
public java.lang.Integer getPacketType()
/** Returns the packet type. Here it is 200 or 201.- Specified by:
getPacketTypein classRTCPPacket- Returns:
- the packet type.
-
decodeSsrc
public static java.lang.Long decodeSsrc(byte[] data, java.lang.Integer offset)Decode SSRC from a SR/RR report.- Parameters:
data- : the data to decode.offset- : the beginning of the report.- Returns:
- SSRC of the report.
-
decodeSrMswNtpTimestamp
public static java.lang.Long decodeSrMswNtpTimestamp(byte[] data, java.lang.Integer offset)Decode MSW Timestamp from a SR report.- Parameters:
data- : the data to decode.offset- : the beginning of the report.- Returns:
- MSW Timestamp of the report.
-
decodeSrLswNtpTimestamp
public static java.lang.Long decodeSrLswNtpTimestamp(byte[] data, java.lang.Integer offset)Decode LSW Timestamp from a SR report.- Parameters:
data- : the data to decode.offset- : the beginning of the report.- Returns:
- LSW Timestamp of the report.
-
setNewValues
public void setNewValues(java.lang.Long rtpTimestamp, java.lang.Long packetCount, java.lang.Long octetCount)To add new value to the SR report.- Parameters:
rtpTimestamp- : the RTP timestamp of the last RTP packet (cf. RFC 3550 p31).packetCount- : the number of packets since the beginning of the RTP session (cf. RFC 3550 p32).octetCount- : the number of octets since the beginning of the RTP session (cf. RFC 3550 p32).
-
-