Package org.red5.server.net.rtmp.codec
Class RTMP
java.lang.Object
org.red5.server.net.rtmp.codec.RTMP
RTMP is the RTMP protocol state representation.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate final class
Channel details(package private) final class
Class for mapping between clock time and stream time for live streams -
Field Summary
Modifier and TypeFieldDescriptionprivate final ConcurrentMap<Integer,
RTMP.ChannelInfo> Map for channels, keyed by channel id.private IConnection.Encoding
Encoding type for objects.private boolean
Encryption flag.private int
Read chunk size.private byte
RTMP state.static final byte
Connect statestatic final byte
Connectedstatic final byte
Disconnectedstatic final byte
In the processing of disconnectingstatic final byte
Sent the connect message to origin.static final byte
Edge is disconnecting, waiting Origin close connection.static final byte
Errorstatic final byte
Handshake state.static final byte
Forwarded client's connect call to origin.static final String[]
private int
Write chunk size. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) void
clearLastTimestampMapping
(int... channelIds) private void
Releases the channels.private void
freePacket
(Packet packet) Releases a packet.private RTMP.ChannelInfo
getChannelInfo
(int channelId) Returns channel information for a given channel id.Getter for encoding version.int
getLastFullTimestampWritten
(int channelId) getLastReadHeader
(int channelId) Return last read header for channel.getLastReadPacket
(int channelId) Return last read packet for channel.getLastReadPacketHeader
(int channelId) Returns the last "read" packet header for the given channel.(package private) RTMP.LiveTimestampMapping
getLastTimestampMapping
(int channelId) getLastWriteHeader
(int channelId) Return last written header for channel.getLastWritePacket
(int channelId) Return packet that has been written last.int
Getter for write chunk size.byte
getState()
Return current state.int
Getter for write chunk size.boolean
void
setEncoding
(IConnection.Encoding encoding) Setter for encoding version.void
setEncrypted
(boolean encrypted) void
setLastFullTimestampWritten
(int channelId, int timer) void
setLastReadHeader
(int channelId, Header header) Setter for last read header.void
setLastReadPacket
(int channelId, Packet packet) Setter for last read packet.void
setLastReadPacketHeader
(int channelId, Header header) Sets the last "read" packet header for the given channel.(package private) void
setLastTimestampMapping
(int channelId, RTMP.LiveTimestampMapping mapping) void
setLastWriteHeader
(int channelId, Header header) Setter for last written header.void
setLastWritePacket
(int channelId, Packet packet) Setter for last written packet.void
setReadChunkSize
(int readChunkSize) Setter for read chunk size.void
setState
(byte state) Setter for state.void
setWriteChunkSize
(int writeChunkSize) Setter for write chunk size.toString()
-
Field Details
-
states
-
STATE_CONNECT
public static final byte STATE_CONNECTConnect state- See Also:
-
STATE_HANDSHAKE
public static final byte STATE_HANDSHAKEHandshake state. Server sends handshake request to client right after connection established.- See Also:
-
STATE_CONNECTED
public static final byte STATE_CONNECTEDConnected- See Also:
-
STATE_ERROR
public static final byte STATE_ERRORError- See Also:
-
STATE_DISCONNECTING
public static final byte STATE_DISCONNECTINGIn the processing of disconnecting- See Also:
-
STATE_DISCONNECTED
public static final byte STATE_DISCONNECTEDDisconnected- See Also:
-
STATE_EDGE_CONNECT_ORIGIN_SENT
public static final byte STATE_EDGE_CONNECT_ORIGIN_SENTSent the connect message to origin.- See Also:
-
STATE_ORIGIN_CONNECT_FORWARDED
public static final byte STATE_ORIGIN_CONNECT_FORWARDEDForwarded client's connect call to origin.- See Also:
-
STATE_EDGE_DISCONNECTING
public static final byte STATE_EDGE_DISCONNECTINGEdge is disconnecting, waiting Origin close connection.- See Also:
-
state
private volatile byte stateRTMP state. -
encrypted
private boolean encryptedEncryption flag. -
channels
Map for channels, keyed by channel id. -
readChunkSize
private int readChunkSizeRead chunk size. Packets are read and written chunk-by-chunk. -
writeChunkSize
private int writeChunkSizeWrite chunk size. Packets are read and written chunk-by-chunk. -
encoding
Encoding type for objects.
-
-
Constructor Details
-
RTMP
public RTMP()Creates RTMP object; essentially for storing session information.
-
-
Method Details
-
getChannelInfo
Returns channel information for a given channel id.- Parameters:
channelId
-- Returns:
- channel info
-
isEncrypted
public boolean isEncrypted()- Returns:
- the encrypted
-
setEncrypted
public void setEncrypted(boolean encrypted) - Parameters:
encrypted
- the encrypted to set
-
getState
public byte getState()Return current state.- Returns:
- State
-
freePacket
Releases a packet.- Parameters:
packet
- Packet to release
-
freeChannels
private void freeChannels()Releases the channels. -
setState
public void setState(byte state) Setter for state.- Parameters:
state
- New state
-
setLastReadHeader
Setter for last read header.- Parameters:
channelId
- Channel idheader
- Header
-
getLastReadHeader
Return last read header for channel.- Parameters:
channelId
- Channel id- Returns:
- Last read header
-
setLastWriteHeader
Setter for last written header.- Parameters:
channelId
- Channel idheader
- Header
-
getLastWriteHeader
Return last written header for channel.- Parameters:
channelId
- Channel id- Returns:
- Last written header
-
setLastReadPacket
Setter for last read packet.- Parameters:
channelId
- Channel idpacket
- Packet
-
getLastReadPacket
Return last read packet for channel.- Parameters:
channelId
- Channel id- Returns:
- Last read packet for that channel
-
setLastWritePacket
Setter for last written packet.- Parameters:
channelId
- Channel idpacket
- Last written packet
-
getLastWritePacket
Return packet that has been written last.- Parameters:
channelId
- Channel id- Returns:
- Packet that has been written last
-
getReadChunkSize
public int getReadChunkSize()Getter for write chunk size. Data is being read chunk-by-chunk.- Returns:
- Read chunk size
-
setReadChunkSize
public void setReadChunkSize(int readChunkSize) Setter for read chunk size. Data is being read chunk-by-chunk.- Parameters:
readChunkSize
- Value to set for property 'readChunkSize'.
-
getWriteChunkSize
public int getWriteChunkSize()Getter for write chunk size. Data is being written chunk-by-chunk.- Returns:
- Write chunk size
-
setWriteChunkSize
public void setWriteChunkSize(int writeChunkSize) Setter for write chunk size.- Parameters:
writeChunkSize
- Write chunk size
-
getEncoding
Getter for encoding version.- Returns:
- Encoding version
-
setEncoding
Setter for encoding version.- Parameters:
encoding
- Encoding version
-
setLastFullTimestampWritten
public void setLastFullTimestampWritten(int channelId, int timer) -
getLastFullTimestampWritten
public int getLastFullTimestampWritten(int channelId) -
setLastReadPacketHeader
Sets the last "read" packet header for the given channel.- Parameters:
channelId
- channel idheader
- header
-
getLastReadPacketHeader
Returns the last "read" packet header for the given channel.- Parameters:
channelId
- channel id- Returns:
- Header
-
getLastTimestampMapping
-
setLastTimestampMapping
-
clearLastTimestampMapping
void clearLastTimestampMapping(int... channelIds) -
toString
-