cnrg.itx.datax.devices
Class BufferQueue
java.lang.Object
|
+--cnrg.itx.datax.devices.BufferQueue
- public class BufferQueue
- extends java.lang.Object
- implements Statistics
This class will implement a buffered queue for reordering incoming
RTP Packetes. The class will allow packets to be removed in a
blocking read which waits until "packet boundries" until serving
out the data.
RTP packets are put into the queue via the
put()<\code> method. It will check to see whether we already
have the sample's data (via a FEC packet). If so, we don't need to
do anything. Otherwise, we should depack the packet and add it into
the queue in the proper order. We should fill in any preceeding
sample "holes" -- places where we should have received a packet but
didn't -- with silence samples. If we later find this packet, the
silence sample should be replaced with the real data. Finally, the
put method should check whether the queue is growing too large
(which indicates that data isn't being read) and "clean" out old
samples by deleting them.
Data samples are removed from the
queue via the get method. The get method will block until a packet
boundary, and then return a sample. The sample will either be the
"correct" sample for that time period, or a silence sample if the
correct sample is not available (and FEC could not fill in the
missing information. For smooth playback, get()
should be
called in succession with minimal processing.
Constructor Summary |
BufferQueue(int iSampleTime,
int iSampleSize,
int iLastPacket)
Constructor for the BufferQueue. |
Method Summary |
void |
dump(java.io.OutputStream os)
|
byte[] |
get()
Gets the next sample from the queue. |
Stats |
getStatistics()
|
void |
put(cnrg.itx.datax.devices.RTPPacket rtp)
Puts a buffer into the queue. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
BufferQueue
public BufferQueue(int iSampleTime,
int iSampleSize,
int iLastPacket)
- Constructor for the BufferQueue.
- Parameters:
iSampleTime
- the reference sample time for the buffer queue
put
public void put(cnrg.itx.datax.devices.RTPPacket rtp)
- Puts a buffer into the queue. Forward error correction is performed
on the buffer and then it is put in the queue.
- Parameters:
rtp
- the RTPPacket to be inserted into the queue
get
public byte[] get()
- Gets the next sample from the queue. Blocks until a time boundary
unless we are "behind". returns null for silence;
getStatistics
public Stats getStatistics()
- Specified by:
- getStatistics in interface Statistics
dump
public void dump(java.io.OutputStream os)