Class RTPExtension


  • public class RTPExtension
    extends Object
    RTP extensions are defined by RFC 5285 and they allow attaching additional information to some or all RTP packets of an RTP stream. This class describes RTP extensions in a way that makes them convenient for use in SDP generation/parsing.
    Author:
    Emil Ivov
    • Field Detail

      • CSRC_AUDIO_LEVEL_URN

        public static final String CSRC_AUDIO_LEVEL_URN
        The URN identifying the RTP extension that allows mixers to send to conference participants the audio levels of all contributing sources. Defined in RFC6465.
        See Also:
        Constant Field Values
      • SSRC_AUDIO_LEVEL_URN

        public static final String SSRC_AUDIO_LEVEL_URN
        The URN identifying the RTP extension that allows clients to send to conference mixers the audio level of their packet payload. Defined in RFC6464.
        See Also:
        Constant Field Values
      • TRANSPORT_CC_URN

        public static final String TRANSPORT_CC_URN
        The URN which identifies the Transport-Wide Congestion Control RTP extension.
        See Also:
        Constant Field Values
      • VIDEO_CONTENT_TYPE_URN

        public static final String VIDEO_CONTENT_TYPE_URN
        The URN which identifies the RTP Header Extension for Video Content Type.
        See Also:
        Constant Field Values
    • Constructor Detail

      • RTPExtension

        public RTPExtension​(URI extensionURI)
        Creates an RTPExtension instance for the specified extensionURI using a default SENDRECV direction and no extension attributes.
        Parameters:
        extensionURI - the URI (possibly a URN) of the RTP extension that we'd like to create.
      • RTPExtension

        public RTPExtension​(URI extensionURI,
                            MediaDirection direction)
        Creates an RTPExtension instance for the specified extensionURI and direction.
        Parameters:
        extensionURI - the URI (possibly a URN) of the RTP extension that we'd like to create.
        direction - a MediaDirection instance indication how this extension will be transmitted.
      • RTPExtension

        public RTPExtension​(URI extensionURI,
                            String extensionAttributes)
        Creates an RTPExtension instance for the specified extensionURI using a default SENDRECV direction and extensionAttributes.
        Parameters:
        extensionURI - the URI (possibly a URN) of the RTP extension that we'd like to create.
        extensionAttributes - any attributes that we'd like to add to this extension.
      • RTPExtension

        public RTPExtension​(URI extensionURI,
                            MediaDirection direction,
                            String extensionAttributes)
        Creates an RTPExtension instance for the specified extensionURI and direction and sets the specified extensionAttributes.
        Parameters:
        extensionURI - the URI (possibly a URN) of the RTP extension that we'd like to create.
        direction - a MediaDirection instance indication how this extension will be transmitted.
        extensionAttributes - any attributes that we'd like to add to this extension.
    • Method Detail

      • getDirection

        public MediaDirection getDirection()
        Returns the direction that the corresponding MediaDevice supports for this extension. By default RTP extension headers inherit the direction of a stream. When explicitly specified SENDONLY direction indicates an ability to attach the extension in outgoing RTP packets; a RECVONLY direction indicates a desire to receive the extension in incoming packets; a SENDRECV direction indicates both. An INACTIVE direction indicates neither, but later re-negotiation may make an extension active.
        Returns:
        the direction that the corresponding MediaDevice supports for this extension.
      • getURI

        public URI getURI()
        Returns the URI that identifies the format and meaning of this extension.
        Returns:
        the URI (possibly a URN) that identifies the format and meaning of this extension.
      • getExtensionAttributes

        public String getExtensionAttributes()
        Returns the extension attributes associated with this RTPExtension or null if this extension does not have any.
        Returns:
        A String containing the extension attributes associated with this RTPExtension or null if this extension does not have any.
      • toString

        public String toString()
        Returns a String representation of this RTPExtension's URI.
        Overrides:
        toString in class Object
        Returns:
        a String representation of this RTPExtension's URI.
      • equals

        public boolean equals​(Object o)
        Returns true if and only if o is an instance of RTPExtension and o's URI is equal to this extension's URI. The method returns false otherwise.
        Overrides:
        equals in class Object
        Parameters:
        o - the Object that we'd like to compare to this RTPExtension.
        Returns:
        true when o's URI is equal to this extension's URI and false otherwise.
      • hashCode

        public int hashCode()
        Returns the hash code of this extension instance which is actually the hash code of the URI that this extension is encapsulating.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code of this extension instance which is actually the hash code of the URI that this extension is encapsulating.