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 ([email protected])
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.slf4j.Loggerprivate intCurrent state.Fields inherited from interface org.red5.server.stream.IFrameDropper
SEND_ALL, SEND_INTERFRAMES, SEND_KEYFRAMES, SEND_KEYFRAMES_CHECK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanSendPacket(RTMPMessage message, long pending) Checks if a message may be sent to the subscriber.voiddropPacket(RTMPMessage message) Notify that a packet has been dropped.voidreset()Reset the frame dropper.voidreset(int state) Reset the frame dropper to a given state.voidsendPacket(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:
resetin interfaceIFrameDropper
-
reset
public void reset(int state) Reset the frame dropper to a given state.- Specified by:
resetin interfaceIFrameDropper- Parameters:
state- the state to reset the frame dropper to
-
canSendPacket
Checks if a message may be sent to the subscriber.- Specified by:
canSendPacketin 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:
dropPacketin interfaceIFrameDropper- Parameters:
message- the message that was dropped
-
sendPacket
Notify that a message has been sent.- Specified by:
sendPacketin interfaceIFrameDropper- Parameters:
message- the message that was sent
-