org.red5.server.stream

## 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 (red5@osflash.org), Joachim Bauch (jojo@struktur.de)

### Field Summary

Fields
`protected static org.slf4j.Logger` `log`

### Fields inherited from interface org.red5.server.stream.IFrameDropper

`SEND_ALL, SEND_INTERFRAMES, SEND_KEYFRAMES, SEND_KEYFRAMES_CHECK`

### Constructor Summary

Constructors
Constructor and Description
`VideoFrameDropper()` Constructs a new VideoFrameDropper.

### Method Summary

Methods
`boolean` `canSendPacket(RTMPMessage message, long pending)` Checks if a message may be sent to the subscriber.
`void` `dropPacket(RTMPMessage message)` Notify that a packet has been dropped.
`void` `reset()` Reset the frame dropper.
`void` `reset(int state)` Reset the frame dropper to a given state.
`void` `sendPacket(RTMPMessage message)` Notify that a message has been sent.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### log

    protected static org.slf4j.Logger log

### Constructor Detail

#### VideoFrameDropper

    public VideoFrameDropper()

Constructs a new VideoFrameDropper.

### Method Detail

#### 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