Class AbstractFECReceiver
- java.lang.Object
-
- org.jitsi.impl.neomedia.transform.fec.AbstractFECReceiver
-
- All Implemented Interfaces:
PacketTransformer
- Direct Known Subclasses:
FlexFec03Receiver,ULPFECReceiver
public abstract class AbstractFECReceiver extends Object implements PacketTransformer
APacketTransformerwhich handles incoming fec packets. This class contains only the generic fec handling logic.- Author:
- bgrozev, bbaldino
-
-
Field Summary
Fields Modifier and Type Field Description protected SortedMap<Integer,RawPacket>fecPacketsBuffer which keeps (copies of) received fec packets.protected booleanhandleFecAllow disabling of handling of ulpfec packets for testing purposes.protected SortedMap<Integer,RawPacket>mediaPacketsBuffer which keeps (copies of) received media packets.protected longssrcThe SSRC of the fec stream NOTE that for ulpfec this might be the same as the associated media stream, whereas for flexfec it will be differentprotected org.jitsi.impl.neomedia.transform.fec.AbstractFECReceiver.StatisticsstatisticsStatistics for this fec receiver
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this PacketTransformer i.e.protected abstract RawPacket[]doReverseTransform(RawPacket[] pkts)Perform fec receive logic specific to the fec implementationRawPacket[]reverseTransform(RawPacket[] pkts)Reverse-transforms each packet in an array of packets.protected voidsaveMedia(RawPacket p)Makes a copy of p into mediaPackets.voidsetPayloadType(byte payloadType)Sets the ulpfec payload type.RawPacket[]transform(RawPacket[] pkts)Transforms each packet in an array of packets.
-
-
-
Field Detail
-
statistics
protected final org.jitsi.impl.neomedia.transform.fec.AbstractFECReceiver.Statistics statistics
Statistics for this fec receiver
-
ssrc
protected long ssrc
The SSRC of the fec stream NOTE that for ulpfec this might be the same as the associated media stream, whereas for flexfec it will be different
-
handleFec
protected boolean handleFec
Allow disabling of handling of ulpfec packets for testing purposes.
-
mediaPackets
protected final SortedMap<Integer,RawPacket> mediaPackets
Buffer which keeps (copies of) received media packets. We keep them ordered by their RTP sequence numbers, so that we can easily select the oldest one to discard when the buffer is full (when the map has more than MEDIA_BUFF_SIZE entries). We keep them in a Map so that we can easily search for a packet with a specific sequence number. Note: This might turn out to be inefficient, especially with increased buffer sizes. In the vast majority of cases (e.g. on every received packet) we do an insert at one end and a delete from the other -- this can be optimized. We very rarely (when we receive a packet out of order) need to insert at an arbitrary location. FIXME: Look at using the existing packet cache instead of our own here
-
fecPackets
protected final SortedMap<Integer,RawPacket> fecPackets
Buffer which keeps (copies of) received fec packets. We keep them ordered by their RTP sequence numbers, so that we can easily select the oldest one to discard when the buffer is full (when the map has more than FEC_BUFF_SIZE entries. We keep them in a Map so that we can easily search for a packet with a specific sequence number. Note: This might turn out to be inefficient, especially with increased buffer sizes. In the vast majority of cases (e.g. on every received packet) we do an insert at one end and a delete from the other -- this can be optimized. We very rarely (when we receive a packet out of order) need to insert at an arbitrary location. FIXME: Look at using the existing packet cache instead of our own here
-
-
Method Detail
-
saveMedia
protected void saveMedia(RawPacket p)
Makes a copy of p into mediaPackets. If the size of mediaPackets has reached MEDIA_BUFF_SIZE discards the oldest packet from it and reuses it.- Parameters:
p- the packet to copy.
-
setPayloadType
public void setPayloadType(byte payloadType)
Sets the ulpfec payload type.- Parameters:
payloadType- the payload type. FIXME(brian): do we need both this and the ability to pass the payload type in the ctor? Can we get rid of this or get rid of the arg in the ctor?
-
transform
public RawPacket[] transform(RawPacket[] pkts)
Transforms each packet in an array of packets. Null values must be ignored. Don't touch "outgoing".- Specified by:
transformin interfacePacketTransformer- Parameters:
pkts- the packets to be transformed- Returns:
- the transformed packets
-
reverseTransform
public RawPacket[] reverseTransform(RawPacket[] pkts)
Description copied from interface:PacketTransformerReverse-transforms each packet in an array of packets. Null values must be ignored.- Specified by:
reverseTransformin interfacePacketTransformer- Parameters:
pkts- the transformed packets to be restored.- Returns:
- the restored packets.
-
close
public void close()
Closes this PacketTransformer i.e. releases the resources allocated by it and prepares it for garbage collection.- Specified by:
closein interfacePacketTransformer
-
-