public class RTPListener
extends java.lang.Thread
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the listener and the sockets by stopping thread.
|
static RTPListener |
getInstance()
Create or get the single instance of the thread
|
java.util.LinkedList<RTPInformation> |
getPackets(java.lang.Integer timeout)
This method return list of packets before cleaning it.
|
void |
openSocket(java.net.InetAddress addr,
java.util.ArrayList<java.lang.Integer> ports)
Open sockets using java.nio
|
void |
run() |
void |
sendPacket(byte[] data,
java.net.InetAddress remoteAddress,
int remotePort,
int localPort)
Send a RTP packet on the given local port to the remote client.
|
void |
startListener()
Start the thread of the singleton if it hasn't been started yet.
|
activeCount, checkAccess, clone, 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
public static RTPListener getInstance()
public void openSocket(java.net.InetAddress addr, java.util.ArrayList<java.lang.Integer> ports)
addr
- : the address to open socket (can be null)ports
- : the ports to openpublic void startListener()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
This method listen to the ports opened previously with openSocket.
The size of RTP/RTCP packets must be less than 512 bytes.
public java.util.LinkedList<RTPInformation> getPackets(java.lang.Integer timeout)
public void sendPacket(byte[] data, java.net.InetAddress remoteAddress, int remotePort, int localPort)
data
- : the packet.remoteAddress
- : InetAddress of the remote client.remotePort
- : the port of the remote client.localPort
- : the port on which the packet is sent.public void close()