Rename AvBufferX -> AvByteBufferX and create AvShortBufferX
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.limelight.nvstream.av;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
public class AvShortBufferPool {
|
||||
private LinkedList<short[]> bufferList = new LinkedList<short[]>();
|
||||
private int bufferSize;
|
||||
|
||||
public AvShortBufferPool(int size)
|
||||
{
|
||||
this.bufferSize = size;
|
||||
}
|
||||
|
||||
public synchronized short[] allocate()
|
||||
{
|
||||
if (bufferList.isEmpty())
|
||||
{
|
||||
return new short[bufferSize];
|
||||
}
|
||||
else
|
||||
{
|
||||
return bufferList.removeFirst();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void free(short[] buffer)
|
||||
{
|
||||
bufferList.addFirst(buffer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user