Package org.red5.server.stream
Class VideoFrameDropper
java.lang.Object
org.red5.server.stream.VideoFrameDropper
- All Implemented Interfaces:
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 Summary
Modifier and TypeFieldDescriptionprotected static org.slf4j.Logger
private int
Current state.Fields inherited from interface org.red5.server.stream.IFrameDropper
SEND_ALL, SEND_INTERFRAMES, SEND_KEYFRAMES, SEND_KEYFRAMES_CHECK
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.
-
Field Details
-
log
protected static org.slf4j.Logger log -
state
private int stateCurrent state.
-
-
Constructor Details
-
VideoFrameDropper
public VideoFrameDropper()Constructs a new VideoFrameDropper.
-
-
Method Details
-
reset
public void reset()Reset the frame dropper.- Specified by:
reset
in interfaceIFrameDropper
-
reset
public void reset(int state) Reset the frame dropper to a given state.- Specified by:
reset
in interfaceIFrameDropper
- Parameters:
state
- the state to reset the frame dropper to
-
canSendPacket
Checks if a message may be sent to the subscriber.- Specified by:
canSendPacket
in interfaceIFrameDropper
- Parameters:
message
- the message to checkpending
- the number of pending messages- Returns:
true
if the packet may be sent, otherwisefalse
-
dropPacket
Notify that a packet has been dropped.- Specified by:
dropPacket
in interfaceIFrameDropper
- Parameters:
message
- the message that was dropped
-
sendPacket
Notify that a message has been sent.- Specified by:
sendPacket
in interfaceIFrameDropper
- Parameters:
message
- the message that was sent
-