public class RawPacketCache
extends java.lang.Object
implements java.lang.AutoCloseable
Modifier and Type | Class and Description |
---|---|
class |
RawPacketCache.Container
A container for packets in the cache.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NACK_CACHE_SIZE_MILLIS
Configuration property for nack cache size in milliseconds.
|
static java.lang.String |
NACK_CACHE_SIZE_PACKETS
Configuration property number of packets to cache.
|
static java.lang.String |
NACK_CACHE_SIZE_STREAMS
Configuration property for number of streams to cache
|
Constructor and Description |
---|
RawPacketCache(int streamId)
Initializes a new
CachingTransformer instance. |
Modifier and Type | Method and Description |
---|---|
void |
cachePacket(RawPacket pkt)
Saves a packet in the cache.
|
void |
clean(long now)
Checks for
Cache instances which have not received new packets
for a period longer than SSRC_TIMEOUT_MILLIS and removes them. |
void |
close() |
RawPacket |
get(long ssrc,
int seq)
Gets the packet with the given SSRC and RTP sequence number from the
cache.
|
RawPacketCache.Container |
getContainer(long ssrc,
int seq)
Gets the packet, encapsulated in a
RawPacketCache.Container with the given SSRC
and RTP sequence number from the cache. |
java.util.Set<RawPacketCache.Container> |
getMany(long ssrc,
int bytes)
Gets the most recent packets from the cache that pertains to the SSRC
that is specified as an argument, not exceeding the number of bytes
specified as an argument.
|
void |
updateTimestamp(long ssrc,
int seq,
long ts)
Updates the timestamp of the packet in the cache with SSRC
ssrc
and sequence number seq , if such a packet exists in the cache,
setting it to ts . |
public static final java.lang.String NACK_CACHE_SIZE_STREAMS
public static final java.lang.String NACK_CACHE_SIZE_PACKETS
public static final java.lang.String NACK_CACHE_SIZE_MILLIS
public RawPacketCache(int streamId)
CachingTransformer
instance.streamId
- the identifier of the owning stream.public void close() throws java.lang.Exception
close
in interface java.lang.AutoCloseable
java.lang.Exception
public RawPacketCache.Container getContainer(long ssrc, int seq)
RawPacketCache.Container
with the given SSRC
and RTP sequence number from the cache. If no such packet is found,
returns null.ssrc
- The SSRC of the packet.seq
- the RTP sequence number of the packet.RawPacketCache.Container
with the given
SSRC and RTP sequence number from the cache. If no such packet is found,
returns null.public RawPacket get(long ssrc, int seq)
ssrc
- The SSRC of the packet.seq
- the RTP sequence number of the packet.public void cachePacket(RawPacket pkt)
pkt
- the packet to save.public void clean(long now)
Cache
instances which have not received new packets
for a period longer than SSRC_TIMEOUT_MILLIS
and removes them.public java.util.Set<RawPacketCache.Container> getMany(long ssrc, int bytes)
ssrc
- the SSRC whose most recent packets to retrieve.bytes
- the maximum total size of the packets to retrieve.public void updateTimestamp(long ssrc, int seq, long ts)
ssrc
and sequence number seq
, if such a packet exists in the cache,
setting it to ts
.ssrc
- the SSRC of the packet.seq
- the sequence number of the packet.ts
- the timestamp to set.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.