Class TransformTCPOutputStream

  • All Implemented Interfaces:
    javax.media.rtp.OutputDataStream, TransformOutputStream

    public class TransformTCPOutputStream
    extends RTPConnectorTCPOutputStream
    implements TransformOutputStream
    Extends RTPConnectorTCPOutputStream with transform logic. In this implementation, TCP socket is used to send the data out. When a normal RTP/RTCP packet is passed down from RTPManager, we first transform the packet using user define PacketTransformer and then send it out through network to all the stream targets.
    Author:
    Bing SU (nova.su@gmail.com), Lubomir Marinov
    • Constructor Detail

      • TransformTCPOutputStream

        public TransformTCPOutputStream​(Socket socket)
        Initializes a new TransformTCPOutputStream which is to send packet data out through a specific TCP socket.
        Parameters:
        socket - the TCP socket used to send packet data out
    • Method Detail

      • getTransformer

        public PacketTransformer getTransformer()
        Gets the PacketTransformer used by this instance to transform RawPackets.
        Specified by:
        getTransformer in interface TransformOutputStream
        Returns:
        the PacketTransformer used by this instance to transform RawPackets
      • packetize

        protected RawPacket[] packetize​(byte[] buf,
                                        int off,
                                        int len,
                                        Object context)
        Creates a RawPacket element from a specific byte[] buffer in order to have this instance send its packet data through its RTPConnectorOutputStream.write(byte[], int, int) method. Returns an array of one or more elements, with the created RawPacket as its first element (and null for all other elements) Allows extenders to intercept the array and possibly filter and/or modify it. Transforms the array of RawPackets returned by the super packetize(byte[],int,int,Object) implementation using the associated PacketTransformer.
        Overrides:
        packetize in class RTPConnectorOutputStream
        Parameters:
        buf - the packet data to be sent to the targets of this instance. The contents of buf starting at off with the specified len is copied into the buffer of the returned RawPacket.
        off - the offset of the packet data in buf
        len - the length of the packet data in buf
        context - the Object provided to RTPConnectorOutputStream.write(byte[], int, int, java.lang.Object). The implementation of RTPConnectorOutputStream ignores the context.
        Returns:
        an array with a single RawPacket containing the packet data of the specified byte[] buffer.
      • setTransformer

        public void setTransformer​(PacketTransformer transformer)
        Sets the PacketTransformer to be used by this instance to transform RawPackets.
        Specified by:
        setTransformer in interface TransformOutputStream
        Parameters:
        transformer - the PacketTransformer to be used by this instance to transform RawPackets