jlibrtp
Class Participant

java.lang.Object
  extended by jlibrtp.Participant

public class Participant
extends java.lang.Object

A participant represents a peer in an RTPSession. Based on the information stored on these objects, packets are processed and statistics generated for RTCP.


Field Summary
protected  long addedByApp
          UNIX time this participant was added by application, to check whether we ever heard back
protected  java.lang.String cname
          SDES CNAME
protected  java.lang.String email
          SDES The participant's email
protected  int firstSeqNumber
          RR First sequence number
protected  double interArrivalJitter
          RR Interarrival jitter
protected  long lastNtpTs1
          Last NTP received in SR packet, MSB
protected  long lastNtpTs2
          Last NTP received in SR packet, LSB
protected  long lastRtcpPkt
          UNIX time of last RTCP packet, to check whether this participant has sent anything recently
protected  long lastRtcpRRPkt
          UNIX time of last time we sent an RR to this user
protected  long lastRtpPkt
          UNIX time of last RTP packet, to check whether this participant has sent anything recently
protected  long lastRtpTimestamp
          RR Last received RTP Timestamp
protected  int lastSeqNumber
          RR Last sequence number
protected  int lastSRRseqNumber
          RR Sequence number associated with last SR
protected  long lastSRRtpTs
          RTP Timestamp in last SR packet
protected  java.lang.String loc
          SDES The participant's location
protected  java.lang.String name
          SDES The participant's real name
protected  java.lang.String note
          SDES A note
protected  double ntpGradient
          Gradient where UNIX timestamp = ntpGradient*RTPTimestamp * ntpOffset
protected  long ntpOffset
          Offset where UNIX timestamp = ntpGradient*RTPTimestamp * ntpOffset
protected  java.lang.String phone
          SDES The participant's phone number
protected  PktBuffer pktBuffer
          Store the packets received from this participant
protected  java.lang.String priv
          SDES A priv string, loosely defined
protected  long receivedOctets
          RR Number of octets received
protected  long receivedPkts
          RR Number of packets received
protected  int receivedSinceLastSR
          RR Number of packets received since last SR
protected  java.net.InetSocketAddress rtcpAddress
          Where to send RTCP packets (unicast)
protected  java.net.InetSocketAddress rtcpReceivedFromAddress
          Where the first RTCP packet was received from
protected  java.net.InetSocketAddress rtpAddress
          Where to send RTP packets (unicast)
protected  java.net.InetSocketAddress rtpReceivedFromAddress
          Where the first RTP packet was received from
protected  long secondLastRtcpRRPkt
          Unix time of second to last time we sent and RR to this user
protected  long seqRollOverCount
          RR Number of times sequence number has rolled over
protected  long ssrc
          SSRC of participant
protected  long timeReceivedLSR
          RR The time when we actually got the last SR
protected  long timestampBYE
          UNIX time when a BYE was received from this participant, for pruning
protected  long timeStampLSR
          RR Middle 32 bits of the NTP timestamp in the last SR
protected  java.lang.String tool
          SDES The tool the participants is using
protected  boolean unexpected
          Whether the participant is unexpected, e.g.
 
Constructor Summary
protected Participant()
           
protected Participant(java.net.InetSocketAddress rtpAdr, java.net.InetSocketAddress rtcpAdr, long SSRC)
           
  Participant(java.lang.String networkAddress, int rtpPort, int rtcpPort)
          Create a basic participant.
 
Method Summary
 void debugPrint()
          Only for debugging purposes
protected  long delaySinceLastSR()
          Calculate the delay between the last received sender report and now.
 java.lang.String getCNAME()
          CNAME registered for this participant.
 java.lang.String getEmail()
          EMAIL registered for this participant.
protected  long getExtHighSeqRecv()
          Calculates the extended highest sequence received by adding the last sequence number to 65536 times the number of times the sequence counter has rolled over.
protected  int getFractionLost()
          Get the fraction of lost packets, calculated as described in RFC 3550 as a fraction of 256.
protected  double getInterArrivalJitter()
           
 java.lang.String getLocation()
          LOCATION registered for this participant.
protected  long getLostPktCount()
          The total number of packets lost during the session.
 java.lang.String getNAME()
          NAME registered for this participant.
 java.lang.String getNote()
          NOTE registered for this participant.
 java.lang.String getPhone()
          PHONE registered for this participant.
 java.lang.String getPriv()
          PRIVATE something registered for this participant.
(package private)  java.net.InetSocketAddress getRtcpReceivedFromAddress()
          InetSocketAddress this participant has used to send us RTCP packets.
(package private)  java.net.InetSocketAddress getRtcpSocketAddress()
          RTCP Address registered with this participant.
(package private)  java.net.InetSocketAddress getRtpReceivedFromAddress()
          InetSocketAddress this participant has used to send us RTP packets.
(package private)  java.net.InetSocketAddress getRtpSocketAddress()
          RTP Address registered with this participant.
 long getSSRC()
          SSRC for participant, determined through RTCP SDES
 java.lang.String getTool()
          TOOL something registered for this participant.
protected  void setTimeStampLSR(long ntp1, long ntp2)
          Set the timestamp for last sender report
protected  void updateRRStats(int packetLength, RtpPkt pkt)
          Updates the participant with information for receiver reports.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unexpected

protected boolean unexpected
Whether the participant is unexpected, e.g. arrived through unicast with SDES


rtpAddress

protected java.net.InetSocketAddress rtpAddress
Where to send RTP packets (unicast)


rtcpAddress

protected java.net.InetSocketAddress rtcpAddress
Where to send RTCP packets (unicast)


rtpReceivedFromAddress

protected java.net.InetSocketAddress rtpReceivedFromAddress
Where the first RTP packet was received from


rtcpReceivedFromAddress

protected java.net.InetSocketAddress rtcpReceivedFromAddress
Where the first RTCP packet was received from


ssrc

protected long ssrc
SSRC of participant


cname

protected java.lang.String cname
SDES CNAME


name

protected java.lang.String name
SDES The participant's real name


email

protected java.lang.String email
SDES The participant's email


phone

protected java.lang.String phone
SDES The participant's phone number


loc

protected java.lang.String loc
SDES The participant's location


tool

protected java.lang.String tool
SDES The tool the participants is using


note

protected java.lang.String note
SDES A note


priv

protected java.lang.String priv
SDES A priv string, loosely defined


firstSeqNumber

protected int firstSeqNumber
RR First sequence number


lastSeqNumber

protected int lastSeqNumber
RR Last sequence number


seqRollOverCount

protected long seqRollOverCount
RR Number of times sequence number has rolled over


receivedPkts

protected long receivedPkts
RR Number of packets received


receivedOctets

protected long receivedOctets
RR Number of octets received


receivedSinceLastSR

protected int receivedSinceLastSR
RR Number of packets received since last SR


lastSRRseqNumber

protected int lastSRRseqNumber
RR Sequence number associated with last SR


interArrivalJitter

protected double interArrivalJitter
RR Interarrival jitter


lastRtpTimestamp

protected long lastRtpTimestamp
RR Last received RTP Timestamp


timeStampLSR

protected long timeStampLSR
RR Middle 32 bits of the NTP timestamp in the last SR


timeReceivedLSR

protected long timeReceivedLSR
RR The time when we actually got the last SR


ntpGradient

protected double ntpGradient
Gradient where UNIX timestamp = ntpGradient*RTPTimestamp * ntpOffset


ntpOffset

protected long ntpOffset
Offset where UNIX timestamp = ntpGradient*RTPTimestamp * ntpOffset


lastNtpTs1

protected long lastNtpTs1
Last NTP received in SR packet, MSB


lastNtpTs2

protected long lastNtpTs2
Last NTP received in SR packet, LSB


lastSRRtpTs

protected long lastSRRtpTs
RTP Timestamp in last SR packet


timestampBYE

protected long timestampBYE
UNIX time when a BYE was received from this participant, for pruning


pktBuffer

protected PktBuffer pktBuffer
Store the packets received from this participant


lastRtpPkt

protected long lastRtpPkt
UNIX time of last RTP packet, to check whether this participant has sent anything recently


lastRtcpPkt

protected long lastRtcpPkt
UNIX time of last RTCP packet, to check whether this participant has sent anything recently


addedByApp

protected long addedByApp
UNIX time this participant was added by application, to check whether we ever heard back


lastRtcpRRPkt

protected long lastRtcpRRPkt
UNIX time of last time we sent an RR to this user


secondLastRtcpRRPkt

protected long secondLastRtcpRRPkt
Unix time of second to last time we sent and RR to this user

Constructor Detail

Participant

public Participant(java.lang.String networkAddress,
                   int rtpPort,
                   int rtcpPort)
Create a basic participant. If this is a unicast session you must provide network address (ipv4 or ipv6) and ports for RTP and RTCP, as well as a cname for this contact. These things should be negotiated through SIP or a similar protocol. jlibrtp will listen for RTCP packets to obtain a matching SSRC for this participant, based on cname.

Parameters:
networkAddress - string representation of network address (ipv4 or ipv6). Use "127.0.0.1" for multicast session.
rtpPort - port on which peer expects RTP packets. Use 0 if this is a sender-only, or this is a multicast session.
rtcpPort - port on which peer expects RTCP packets. Use 0 if this is a sender-only, or this is a multicast session.

Participant

protected Participant(java.net.InetSocketAddress rtpAdr,
                      java.net.InetSocketAddress rtcpAdr,
                      long SSRC)

Participant

protected Participant()
Method Detail

getRtpSocketAddress

java.net.InetSocketAddress getRtpSocketAddress()
RTP Address registered with this participant.

Returns:
address of participant

getRtcpSocketAddress

java.net.InetSocketAddress getRtcpSocketAddress()
RTCP Address registered with this participant.

Returns:
address of participant

getRtpReceivedFromAddress

java.net.InetSocketAddress getRtpReceivedFromAddress()
InetSocketAddress this participant has used to send us RTP packets.

Returns:
address of participant

getRtcpReceivedFromAddress

java.net.InetSocketAddress getRtcpReceivedFromAddress()
InetSocketAddress this participant has used to send us RTCP packets.

Returns:
address of participant

getCNAME

public java.lang.String getCNAME()
CNAME registered for this participant.

Returns:
the cname

getNAME

public java.lang.String getNAME()
NAME registered for this participant.

Returns:
the name

getEmail

public java.lang.String getEmail()
EMAIL registered for this participant.

Returns:
the email address

getPhone

public java.lang.String getPhone()
PHONE registered for this participant.

Returns:
the phone number

getLocation

public java.lang.String getLocation()
LOCATION registered for this participant.

Returns:
the location

getNote

public java.lang.String getNote()
NOTE registered for this participant.

Returns:
the note

getPriv

public java.lang.String getPriv()
PRIVATE something registered for this participant.

Returns:
the private-string

getTool

public java.lang.String getTool()
TOOL something registered for this participant.

Returns:
the tool

getSSRC

public long getSSRC()
SSRC for participant, determined through RTCP SDES

Returns:
SSRC (32 bit unsigned integer as long)

updateRRStats

protected void updateRRStats(int packetLength,
                             RtpPkt pkt)
Updates the participant with information for receiver reports.

Parameters:
packetLength - to keep track of received octets
pkt - the most recently received packet

getExtHighSeqRecv

protected long getExtHighSeqRecv()
Calculates the extended highest sequence received by adding the last sequence number to 65536 times the number of times the sequence counter has rolled over.

Returns:
extended highest sequence

getFractionLost

protected int getFractionLost()
Get the fraction of lost packets, calculated as described in RFC 3550 as a fraction of 256.

Returns:
the fraction of lost packets since last SR received

getLostPktCount

protected long getLostPktCount()
The total number of packets lost during the session. Returns zero if loss is negative, i.e. duplicates have been received.

Returns:
number of lost packets, or zero.

getInterArrivalJitter

protected double getInterArrivalJitter()
Returns:
the interArrivalJitter, calculated continuously

setTimeStampLSR

protected void setTimeStampLSR(long ntp1,
                               long ntp2)
Set the timestamp for last sender report

Parameters:
ntp1 - high order bits
ntp2 - low order bits

delaySinceLastSR

protected long delaySinceLastSR()
Calculate the delay between the last received sender report and now.

Returns:
the delay in units of 1/65.536ms

debugPrint

public void debugPrint()
Only for debugging purposes