public abstract class RTPConnectorInputStream<T extends Closeable> extends Object implements javax.media.protocol.PushSourceStream, Closeable
| Modifier and Type | Field and Description |
|---|---|
static int |
PACKET_RECEIVE_BUFFER_LENGTH
The length in bytes of the buffers of RTPConnectorInputStream
receiving packets from the network.
|
static String |
SO_RCVBUF_PNAME
The name of the property which controls the size of the receive buffer
which
RTPConnectorInputStream will request for the sockets that
it uses. |
protected T |
socket |
| Modifier | Constructor and Description |
|---|---|
protected |
RTPConnectorInputStream(T socket)
Initializes a new RTPConnectorInputStream which is to receive
packet data from a specific UDP socket.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDatagramPacketFilter(org.jitsi.utils.DatagramPacketFilter datagramPacketFilter)
Adds a DatagramPacketFilter which allows dropping
DatagramPackets before they are converted into
RawPackets.
|
void |
close()
Close this stream, stops the worker thread.
|
protected RawPacket[] |
createRawPacket(DatagramPacket datagramPacket)
Creates a new RawPacket from a specific DatagramPacket
in order to have this instance receive its packet data through its
read(byte[], int, int) method. |
protected abstract void |
doLogPacket(DatagramPacket packet)
Log the packet.
|
boolean |
endOfStream()
Provides a dummy implementation of
SourceStream.endOfStream() that always returns
false. |
javax.media.protocol.ContentDescriptor |
getContentDescriptor()
Provides a dummy implementation of
SourceStream.getContentDescriptor() that always returns
null. |
long |
getContentLength()
Provides a dummy implementation of
SourceStream.getContentLength() that always returns
LENGTH_UNKNOWN. |
Object |
getControl(String controlType)
Provides a dummy implementation of
Controls.getControl(String) that always returns
null. |
Object[] |
getControls()
Provides a dummy implementation of
Controls.getControls() that always returns
EMPTY_CONTROLS. |
protected org.jitsi.utils.DatagramPacketFilter[] |
getDatagramPacketFilters()
Gets the DatagramPacketFilters which allow dropping
DatagramPackets before they are converted into
RawPackets.
|
long |
getLastActivityTime()
Gets the time in milliseconds of the last activity related to this
RTPConnectorInputStream.
|
int |
getMinimumTransferSize()
Provides a dummy implementation of
PushSourceStream.getMinimumTransferSize() that always returns
2 * 1024. |
long |
getNumberOfReceivedBytes()
Returns the number of received bytes for the stream.
|
protected PacketLoggingService |
getPacketLoggingService()
Gets the
PacketLoggingService (to be) utilized by this instance. |
protected int |
read(javax.media.Buffer buffer,
byte[] data,
int offset,
int length)
Copies the content of the most recently received packet into
data.
|
int |
read(byte[] buffer,
int offset,
int length)
Copies the content of the most recently received packet into
buffer.
|
protected abstract void |
receive(DatagramPacket p)
Receive packet.
|
void |
setEnabled(boolean enabled)
Enables or disables this RTPConnectorInputStream.
|
void |
setPriority(int priority)
Changes current thread priority.
|
protected abstract void |
setReceiveBufferSize(int receiveBufferSize) |
static void |
setThreadPriority(Thread thread,
int priority)
Sets a specific priority on a specific Thread.
|
void |
setTransferHandler(javax.media.protocol.SourceTransferHandler transferHandler)
Sets the transferHandler that this connector should be notifying
when new data is available for reading.
|
public static final int PACKET_RECEIVE_BUFFER_LENGTH
public static final String SO_RCVBUF_PNAME
RTPConnectorInputStream will request for the sockets that
it uses.protected RTPConnectorInputStream(T socket)
public static void setThreadPriority(Thread thread, int priority)
thread - the Thread to set the specified priority
onpriority - the priority to set on the specified threadpublic long getLastActivityTime()
public void addDatagramPacketFilter(org.jitsi.utils.DatagramPacketFilter datagramPacketFilter)
datagramPacketFilter - the DatagramPacketFilter which
allows dropping DatagramPackets before they are converted into
RawPacketspublic void close()
close in interface Closeableclose in interface AutoCloseableprotected RawPacket[] createRawPacket(DatagramPacket datagramPacket)
read(byte[], int, int) method. Returns an array of
RawPacket with the created packet as its first element (and
null for the other elements).
Allows extenders to intercept the packet data and possibly filter and/or
modify it.datagramPacket - the DatagramPacket containing the packet
dataprotected abstract void doLogPacket(DatagramPacket packet)
packet - packet to logpublic boolean endOfStream()
SourceStream.endOfStream() that always returns
false.endOfStream in interface javax.media.protocol.SourceStreampublic javax.media.protocol.ContentDescriptor getContentDescriptor()
SourceStream.getContentDescriptor() that always returns
null.getContentDescriptor in interface javax.media.protocol.SourceStreampublic long getContentLength()
SourceStream.getContentLength() that always returns
LENGTH_UNKNOWN.getContentLength in interface javax.media.protocol.SourceStreampublic Object getControl(String controlType)
Controls.getControl(String) that always returns
null.getControl in interface javax.media.ControlscontrolType - ignored.public Object[] getControls()
Controls.getControls() that always returns
EMPTY_CONTROLS.getControls in interface javax.media.Controlsprotected org.jitsi.utils.DatagramPacketFilter[] getDatagramPacketFilters()
public int getMinimumTransferSize()
PushSourceStream.getMinimumTransferSize() that always returns
2 * 1024.getMinimumTransferSize in interface javax.media.protocol.PushSourceStreampublic long getNumberOfReceivedBytes()
protected PacketLoggingService getPacketLoggingService()
PacketLoggingService (to be) utilized by this instance.PacketLoggingService (to be) utilized by this
instanceprotected int read(javax.media.Buffer buffer,
byte[] data,
int offset,
int length)
throws IOException
buffer - an optional Buffer instance associated with the
specified data, offset and length and
provided to the method in case the implementation would like to provide
additional Buffer properties such as flagsdata - the byte[] that we'd like to copy the content of
the packet to.offset - the position where we are supposed to start writing in
data.length - the number of bytes available for writing in
data.IOException - if length is less than the size of the
packet.public int read(byte[] buffer,
int offset,
int length)
throws IOException
read in interface javax.media.protocol.PushSourceStreambuffer - the byte[] that we'd like to copy the content of
the packet to.offset - the position where we are supposed to start writing in
buffer.length - the number of bytes available for writing in
buffer.IOException - if length is less than the size of the
packet.protected abstract void receive(DatagramPacket p) throws IOException
p - packet for receivingIOException - if something goes wrong during receivingpublic void setEnabled(boolean enabled)
enabled - true to enable, false to disable.public void setPriority(int priority)
priority - the new priority.protected abstract void setReceiveBufferSize(int receiveBufferSize)
throws IOException
IOExceptionpublic void setTransferHandler(javax.media.protocol.SourceTransferHandler transferHandler)
setTransferHandler in interface javax.media.protocol.PushSourceStreamtransferHandler - the transferHandler that this connector
should be notifying when new data is available for reading.Copyright © 2022 jitsi.org. All rights reserved.