org.mobicents.media.server.component
Class ElasticBuffer

java.lang.Object
  extended by org.mobicents.media.server.component.ElasticBuffer

public class ElasticBuffer
extends Object

Elastic buffer is asynchronous FIFO buffer wich automatically compensates for drift between receiver clock and transmitter clock signals.

Author:
kulikov

Constructor Summary
ElasticBuffer(int delay, int limit)
          Creates new elastic buffer.
 
Method Summary
 void clear()
           
 boolean isEmpty()
           
 Frame read()
          Retreives and removes frame from the head of the buffer.
 void setListener(BufferListener listener)
          Sets buffer state monitor.
 void write(Frame frame)
          Writes given frame to the tail of the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElasticBuffer

public ElasticBuffer(int delay,
                     int limit)
Creates new elastic buffer.

Parameters:
delay - the initial delay of signal measured in frames
limit - the physical limit of the buffer measured in frames.
Method Detail

setListener

public void setListener(BufferListener listener)
Sets buffer state monitor.

Parameters:
listener - the monitor implementation.

write

public void write(Frame frame)
Writes given frame to the tail of the buffer.

Parameters:
frame - the frame to write

read

public Frame read()
Retreives and removes frame from the head of the buffer.

Returns:
the frame or null if buffer is empty.

clear

public void clear()

isEmpty

public boolean isEmpty()


Copyright © 2011. All Rights Reserved.