Class PlayBuffer

java.lang.Object
org.red5.server.stream.PlayBuffer

public class PlayBuffer extends Object
A Play buffer for sending VOD. The implementation is not synchronized.
Author:
The Red5 Project, Steven Gong (steven.gong@gmail.com)
  • Field Details

    • capacity

      private long capacity
      Buffer capacity
    • messageSize

      private long messageSize
      Message size
    • messageQueue

      private Queue<RTMPMessage> 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

      public boolean putMessage(RTMPMessage message)
      Put a message into this buffer.
      Parameters:
      message - RTMP message
      Returns:
      true indicates success and false indicates buffer is full.
    • takeMessage

      public RTMPMessage takeMessage()
      Take a message from this buffer. The message count decreases.
      Returns:
      null if buffer is empty.
    • peekMessage

      public RTMPMessage 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.