|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjlibrtp.RTPSession
public class RTPSession
The RTPSession object is the core of jlibrtp. One should be instantiated for every communication channel, i.e. if you send voice and video, you should create one for each. The instance holds a participant database, as well as other information about the session. When the application registers with the session, the necessary threads for receiving and processing RTP packets are spawned. RTP Packets are sent synchronously, all other operations are asynchronous.
Field Summary | |
---|---|
java.lang.String |
email
SDES The participant's email |
java.lang.String |
loc
SDES The participant's location |
java.lang.String |
name
SDES The participant's real name |
java.lang.String |
note
SDES A note |
java.lang.String |
phone
SDES The participant's phone number |
java.lang.String |
priv
SDES A priv string, loosely defined |
static int |
rtcpDebugLevel
The debug level is final to avoid compilation of if-statements. 0 provides no debugging information, 20 provides everything Debug output is written to System.out Debug level for RTCP related things. |
static int |
rtpDebugLevel
The debug level is final to avoid compilation of if-statements. 0 provides no debugging information, 20 provides everything Debug output is written to System.out Debug level for RTP related things. |
java.lang.String |
tool
SDES The tool the participants is using |
Constructor Summary | |
---|---|
RTPSession(java.net.DatagramSocket rtpSocket,
java.net.DatagramSocket rtcpSocket)
Returns an instance of a unicast RTP session. |
|
RTPSession(java.net.MulticastSocket rtpSock,
java.net.MulticastSocket rtcpSock,
java.net.InetAddress multicastGroup)
Returns an instance of a multicast RTP session. |
Method Summary | |
---|---|
int |
addParticipant(Participant p)
Add a participant object to the participant database. |
java.lang.String |
CNAME()
Get the current CNAME, used for outgoing SDES packets |
void |
CNAME(java.lang.String cname)
Overrides CNAME, used for outgoing RTCP packets. |
void |
endSession()
End the RTP Session. |
int |
fbAppLayerFeedback(long ssrcMediaSource,
byte[] bitString)
Adds a Picture Loss Indication to the feedback queue |
int |
fbPictureLossIndication(long ssrcMediaSource)
Adds a Picture Loss Indication to the feedback queue |
int |
fbPictureLossIndication(long ssrcMediaSource,
int FMT,
int[] PID,
int[] BLP)
Adds a RTP Feedback packet to the feedback queue. |
int |
fbRefPictureSelIndic(long ssrcMediaSource,
int bitPadding,
int payloadType,
byte[] bitString)
Adds a Reference Picture Selection Indication to the feedback queue |
int |
fbSlicLossIndication(long ssrcMediaSource,
int[] sliFirst,
int[] sliNumber,
int[] sliPictureId)
Adds a Slice Loss Indication to the feedback queue |
boolean |
frameReconstruction()
Whether the packet buffer will attempt to reconstruct packet automatically. |
void |
frameReconstruction(boolean toggle)
Enable / disable frame reconstruction in the packet buffers. |
java.util.Enumeration<Participant> |
getParticipants()
|
long |
getSsrc()
|
java.util.Iterator<Participant> |
getUnicastReceivers()
|
boolean |
naivePktReception()
Are packets from unknown participants returned to the application? |
void |
naivePktReception(boolean doAccept)
Should packets from unknown participants be returned to the application? This can be dangerous. |
int |
packetBufferBehavior()
The number of RTP packets that should be buffered when a packet is missing or received out of order. |
int |
packetBufferBehavior(int behavior)
Set the number of RTP packets that should be buffered when a packet is missing or received out of order. |
int |
payloadType()
Get the payload type that is currently used for outgoing RTP packets. |
int |
payloadType(int payloadT)
Update the payload type used for the session. |
int |
registerAVPFIntf(RTCPAVPFIntf rtcpAVPFIntf,
int maxDelay,
int earlyThreshold,
int regularThreshold)
Set whether the stack should operate in RFC 4585 mode. |
void |
removeParticipant(Participant p)
Remove a participant from the database. |
int |
rtcpBandwidth()
RFC 3550 dictates that 5% of the total bandwidth, as set by sessionBandwidth, should be dedicated to RTCP traffic. |
int |
rtcpBandwidth(int bandwidth)
Set the RTCP bandwidth, see rtcpBandwidth(void) for details. |
int |
RTPSessionRegister(RTPAppIntf rtpApp,
RTCPAppIntf rtcpApp,
DebugAppIntf debugApp)
Registers an application (RTPAppIntf) with the RTP session. |
long[] |
sendData(byte[] buf)
Send data to all participants registered as receivers, using the current timeStamp, dynamic sequence number and the current payload type specified for the session. |
long[][] |
sendData(byte[][] buffers,
long[] csrcArray,
boolean[] markers,
long rtpTimestamp,
long[] seqNumbers)
Send data to all participants registered as receivers, using the current timeStamp and payload type. |
long[] |
sendData(byte[] buf,
long rtpTimestamp,
long seqNum)
Send data to all participants registered as receivers, using the specified timeStamp, sequence number and the current payload type specified for the session. |
int |
sendRTCPAppPacket(long ssrc,
int type,
byte[] name,
byte[] data)
Send RTCP App packet to receiver specified by ssrc Return values: 0 okay -1 no RTCP session established -2 name is not byte[4]; -3 data is not byte[x], where x = 4*y for syme y -4 type is not a 5 bit unsigned integer Note that a return value of 0 does not guarantee delivery. |
int |
sessionBandwidth()
The bandwidth currently allocated to the session, in bytes per second. |
int |
sessionBandwidth(int bandwidth)
Set the bandwidth of the session. |
void |
unregisterAVPFIntf()
Unregisters the RTCP AVPF interface, thereby going from RFC 4585 mode to RFC 3550 You still have to adjust packetBufferBehavior() and frameReconstruction. |
int |
updateRTCPSock(java.net.DatagramSocket newSock)
Change the RTCP socket of the session. |
int |
updateRTCPSock(java.net.MulticastSocket newSock)
Change the RTCP multicast socket of the session. |
int |
updateRTPSock(java.net.DatagramSocket newSock)
Change the RTP socket of the session. |
int |
updateRTPSock(java.net.MulticastSocket newSock)
Change the RTP multicast socket of the session. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int rtpDebugLevel
public static final int rtcpDebugLevel
public java.lang.String name
public java.lang.String email
public java.lang.String phone
public java.lang.String loc
public java.lang.String tool
public java.lang.String note
public java.lang.String priv
Constructor Detail |
---|
public RTPSession(java.net.DatagramSocket rtpSocket, java.net.DatagramSocket rtcpSocket)
rtpSocket
- UDP socket to receive RTP communication onrtcpSocket
- UDP socket to receive RTCP communication on, null if none.public RTPSession(java.net.MulticastSocket rtpSock, java.net.MulticastSocket rtcpSock, java.net.InetAddress multicastGroup) throws java.lang.Exception
rtpSock
- a multicast socket to receive RTP communication onrtcpSock
- a multicast socket to receive RTP communication onmulticastGroup
- the multicast group that we want to communicate with.
java.lang.Exception
Method Detail |
---|
public int RTPSessionRegister(RTPAppIntf rtpApp, RTCPAppIntf rtcpApp, DebugAppIntf debugApp)
rtpApp
- an object that implements the RTPAppIntf-interfacertcpApp
- an object that implements the RTCPAppIntf-interface (optional)
public long[] sendData(byte[] buf)
buf
- A buffer of bytes, less than 1496 bytes
public long[] sendData(byte[] buf, long rtpTimestamp, long seqNum)
buf
- A buffer of bytes, less than 1496 bytesrtpTimestamp
- the RTP timestamp to be used in the packetseqNum
- the sequence number to be used in the packet
public long[][] sendData(byte[][] buffers, long[] csrcArray, boolean[] markers, long rtpTimestamp, long[] seqNumbers)
buffers
- A buffer of bytes, should not bed padded and less than 1500 bytes on most networks.csrcArray
- an array with the SSRCs of contributing sourcesmarkers
- An array indicating what packets should be marked. Rarely anything but the first onertpTimestamp
- The RTP timestamp to be applied to all packetsseqNumbers
- An array with the sequence number associated with each byte[]
public int sendRTCPAppPacket(long ssrc, int type, byte[] name, byte[] data)
ssrc
- of the participant you want to reachtype
- the RTCP App packet subtype, default 0name
- the ASCII (in byte[4]) representationdata
- the data itself
public int addParticipant(Participant p)
p
- A participant.public void removeParticipant(Participant p)
p
- A participant.public java.util.Iterator<Participant> getUnicastReceivers()
public java.util.Enumeration<Participant> getParticipants()
public void endSession()
public void CNAME(java.lang.String cname)
cname
- a string, e.g. username@hostname. Must be unique for session.public java.lang.String CNAME()
public long getSsrc()
public int updateRTPSock(java.net.DatagramSocket newSock)
newSock
- integer for new port number, check it is free first.public int updateRTCPSock(java.net.DatagramSocket newSock)
newSock
- the new unicast socket for RTP communication.public int updateRTPSock(java.net.MulticastSocket newSock)
newSock
- the new multicast socket for RTP communication.public int updateRTCPSock(java.net.MulticastSocket newSock)
newSock
- the new multicast socket for RTCP communication.public int payloadType(int payloadT)
payloadT
- an integer representing the payload type of any subsequent packets that are sent.public int payloadType()
public void naivePktReception(boolean doAccept)
doAccept
- packets from participants not added by the application.public boolean naivePktReception()
public int packetBufferBehavior(int behavior)
behavior
- the be
public int packetBufferBehavior()
public int registerAVPFIntf(RTCPAVPFIntf rtcpAVPFIntf, int maxDelay, int earlyThreshold, int regularThreshold)
rtcpAVPFIntf
- the inpublic void unregisterAVPFIntf()
public void frameReconstruction(boolean toggle)
public boolean frameReconstruction()
public int sessionBandwidth()
public int sessionBandwidth(int bandwidth)
bandwidth
- the new value requested, in bytes per second
public int rtcpBandwidth()
public int rtcpBandwidth(int bandwidth)
bandwidth
- the new value requested, in bytes per second or -1 to disable
public int fbPictureLossIndication(long ssrcMediaSource)
ssrcMediaSource
-
public int fbSlicLossIndication(long ssrcMediaSource, int[] sliFirst, int[] sliNumber, int[] sliPictureId)
ssrcMediaSource
- sliFirst
- macroblock (MB) address of the first lost macroblocksliNumber
- number of lost macroblockssliPictureId
- six least significant bits of the codec-specific identif
public int fbRefPictureSelIndic(long ssrcMediaSource, int bitPadding, int payloadType, byte[] bitString)
ssrcMediaSource
- bitPadding
- number of padded bits at end of bitStringpayloadType
- RTP payload type for codecbitString
- RPSI information as natively defined by the video codec
public int fbAppLayerFeedback(long ssrcMediaSource, byte[] bitString)
ssrcMediaSource
- bitString
- the original application message
public int fbPictureLossIndication(long ssrcMediaSource, int FMT, int[] PID, int[] BLP)
ssrcMediaSource
- FMT
- the Feedback Message SubtypePID
- RTP sequence numbers of lost packetsBLP
- bitmask of following lost packets, shared index with PID
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |