jlibrtp
Class RTCPSenderThread

java.lang.Object
  extended by java.lang.Thread
      extended by jlibrtp.RTCPSenderThread
All Implemented Interfaces:
java.lang.Runnable

public class RTCPSenderThread
extends java.lang.Thread

This thread sends scheduled RTCP packets It also performs maintenance of various queues and the participant database.

Author:
Arne Kepp

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  boolean byesSent
          Whether we have sent byes for the last conflict
private  RTCPSession rtcpSession
          Parent RTCP Session
private  RTPSession rtpSession
          Parent RTP Session
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected RTCPSenderThread(RTCPSession rtcpSession, RTPSession rtpSession)
          Constructor for new thread
 
Method Summary
protected  int mcSendCompRtcpPkt(CompRtcpPkt pkt)
          Multicast version of sending a Compound RTCP packet
protected  CompRtcpPkt preparePacket(Participant part, boolean regular)
          Prepare a packet.
protected  void reconsiderTiming(long ssrc)
          Check whether we can send an immediate feedback packet to this person
 void run()
          Start the RTCP sender thread.
protected  void sendByes()
          Send BYE messages to all the relevant participants
protected  int sendCompRtcpPkt(CompRtcpPkt pkt, java.net.InetSocketAddress receiver)
          Unicast version of sending a Compound RTCP packet
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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
 

Field Detail

rtpSession

private RTPSession rtpSession
Parent RTP Session


rtcpSession

private RTCPSession rtcpSession
Parent RTCP Session


byesSent

private boolean byesSent
Whether we have sent byes for the last conflict

Constructor Detail

RTCPSenderThread

protected RTCPSenderThread(RTCPSession rtcpSession,
                           RTPSession rtpSession)
Constructor for new thread

Parameters:
rtcpSession - parent RTCP session
rtpSession - parent RTP session
Method Detail

sendByes

protected void sendByes()
Send BYE messages to all the relevant participants


mcSendCompRtcpPkt

protected int mcSendCompRtcpPkt(CompRtcpPkt pkt)
Multicast version of sending a Compound RTCP packet

Parameters:
pkt - the packet to best
Returns:
0 is successful, -1 otherwise

sendCompRtcpPkt

protected int sendCompRtcpPkt(CompRtcpPkt pkt,
                              java.net.InetSocketAddress receiver)
Unicast version of sending a Compound RTCP packet

Parameters:
pkt - the packet to best
receiver - the socket address of the recipient
Returns:
0 is successful, -1 otherwise

reconsiderTiming

protected void reconsiderTiming(long ssrc)
Check whether we can send an immediate feedback packet to this person

Parameters:
ssrc - SSRC of participant

preparePacket

protected CompRtcpPkt preparePacket(Participant part,
                                    boolean regular)
Prepare a packet. The output depends on the participant and how the packet is scheduled.

Parameters:
part - the participant to report to
regular - whether this is a regularly, or early scheduled RTCP packet
Returns:
compound RTCP packet

run

public void run()
Start the RTCP sender thread. RFC 4585 is more complicated, but in general it will 1) Wait a precalculated amount of time 2) Determine the next RTCP recipient 3) Construct a compound packet with all the relevant information 4) Send the packet 5) Calculate next delay before going to sleep

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread