Class VideoFrameDropper

java.lang.Object
org.red5.server.stream.VideoFrameDropper
All Implemented Interfaces:
IFrameDropper

public class VideoFrameDropper extends Object implements IFrameDropper
State machine for video frame dropping in live streams.

We start sending all frame types. Disposable interframes can be dropped any time without affecting the current state. If a regular interframe is dropped, all future frames up to the next keyframes are dropped as well. Dropped keyframes result in only keyframes being sent. If two consecutive keyframes have been successfully sent, regular interframes will be sent in the next iteration as well. If these frames all went through, disposable interframes are sent again.

So from highest to lowest bandwidth and back, the states go as follows:

  • all frames
  • keyframes and interframes
  • keyframes
  • keyframes and interframes
  • all frames
Author:
The Red5 Project, Joachim Bauch (jojo@struktur.de)
  • Field Details

    • log

      protected static org.slf4j.Logger log
    • state

      private int state
      Current state.
  • Constructor Details

    • VideoFrameDropper

      public VideoFrameDropper()
      Constructs a new VideoFrameDropper.
  • Method Details

    • reset

      public void reset()
      Reset the frame dropper.
      Specified by:
      reset in interface IFrameDropper
    • reset

      public void reset(int state)
      Reset the frame dropper to a given state.
      Specified by:
      reset in interface IFrameDropper
      Parameters:
      state - the state to reset the frame dropper to
    • canSendPacket

      public boolean canSendPacket(RTMPMessage message, long pending)
      Checks if a message may be sent to the subscriber.
      Specified by:
      canSendPacket in interface IFrameDropper
      Parameters:
      message - the message to check
      pending - the number of pending messages
      Returns:
       true
       
      if the packet may be sent, otherwise
       false
       
    • dropPacket

      public void dropPacket(RTMPMessage message)
      Notify that a packet has been dropped.
      Specified by:
      dropPacket in interface IFrameDropper
      Parameters:
      message - the message that was dropped
    • sendPacket

      public void sendPacket(RTMPMessage message)
      Notify that a message has been sent.
      Specified by:
      sendPacket in interface IFrameDropper
      Parameters:
      message - the message that was sent