Class RtspDecoder

All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler
Direct Known Subclasses:
RtspRequestDecoder, RtspResponseDecoder

public class RtspDecoder extends HttpObjectDecoder
Decodes ByteBufs into RTSP messages represented in HttpMessages.

Parameters that prevents excessive memory consumption

NameMeaning
maxInitialLineLength The maximum length of the initial line (e.g. "SETUP / RTSP/1.0" or "RTSP/1.0 200 OK") If the length of the initial line exceeds this value, a TooLongFrameException will be raised.
maxHeaderSize The maximum length of all headers. If the sum of the length of each header exceeds this value, a TooLongFrameException will be raised.
maxContentLength The maximum length of the content. If the content length exceeds this value, a TooLongFrameException will be raised.
  • Field Details

    • UNKNOWN_STATUS

      private static final HttpResponseStatus UNKNOWN_STATUS
      Status code for unknown responses.
    • isDecodingRequest

      private boolean isDecodingRequest
      True if the message to decode is a request. False if the message to decode is a response.
    • versionPattern

      private static final Pattern versionPattern
      Regex used on first line in message to detect if it is a response.
    • DEFAULT_MAX_CONTENT_LENGTH

      public static final int DEFAULT_MAX_CONTENT_LENGTH
      Constant for default max content length.
      See Also:
  • Constructor Details

    • RtspDecoder

      public RtspDecoder()
      Creates a new instance with the default maxInitialLineLength (4096), maxHeaderSize (8192), and maxContentLength (8192).
    • RtspDecoder

      public RtspDecoder(int maxInitialLineLength, int maxHeaderSize, int maxContentLength)
      Creates a new instance with the specified parameters.
      Parameters:
      maxInitialLineLength - The max allowed length of initial line
      maxHeaderSize - The max allowed size of header
      maxContentLength - The max allowed content length
    • RtspDecoder

      @Deprecated public RtspDecoder(int maxInitialLineLength, int maxHeaderSize, int maxContentLength, boolean validateHeaders)
      Deprecated.
      Use the RtspDecoder(HttpDecoderConfig) constructor instead, or the RtspDecoder(int, int, int) to always enable header validation.
      Creates a new instance with the specified parameters.
      Parameters:
      maxInitialLineLength - The max allowed length of initial line
      maxHeaderSize - The max allowed size of header
      maxContentLength - The max allowed content length
      validateHeaders - Set to true if headers should be validated
    • RtspDecoder

      public RtspDecoder(HttpDecoderConfig config)
      Creates a new instance with the specified configuration.
  • Method Details