Package org.red5.server.stream
Class PlayBuffer
java.lang.Object
org.red5.server.stream.PlayBuffer
A Play buffer for sending VOD. The implementation is not synchronized.
- Author:
- The Red5 Project, Steven Gong ([email protected])
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longBuffer capacityprivate Queue<RTMPMessage>Queue of RTMP messagesprivate longMessage size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Empty this buffer.longBuffer capacity in bytes.intNumber of messages in buffer.longTotal message size in bytes.Peek a message but not take it from the buffer.booleanputMessage(RTMPMessage message) Put a message into this buffer.voidsetCapacity(long capacity) Setter for capacityTake a message from this buffer.
-
Field Details
-
capacity
private long capacityBuffer capacity -
messageSize
private long messageSizeMessage size -
messageQueue
Queue of RTMP messages
-
-
Constructor Details
-
PlayBuffer
public PlayBuffer(long capacity) Create play buffer with given capacity- Parameters:
capacity- Capacity of buffer
-
-
Method Details
-
getCapacity
public long getCapacity()Buffer capacity in bytes.- Returns:
- Buffer capacity in bytes
-
setCapacity
public void setCapacity(long capacity) Setter for capacity- Parameters:
capacity- New capacity
-
getMessageCount
public int getMessageCount()Number of messages in buffer.- Returns:
- Number of messages in buffer
-
getMessageSize
public long getMessageSize()Total message size in bytes.- Returns:
- Total message size in bytes
-
putMessage
Put a message into this buffer.- Parameters:
message- RTMP message- Returns:
- true indicates success and false indicates buffer is full.
-
takeMessage
Take a message from this buffer. The message count decreases.- Returns:
- null if buffer is empty.
-
peekMessage
Peek a message but not take it from the buffer. The message count doesn't change.- Returns:
- null if buffer is empty.
-
clear
public void clear()Empty this buffer.
-