Class ResumableStreamRewriter


  • public class ResumableStreamRewriter
    extends Object
    Rewrites sequence numbers for RTP streams by hiding any gaps caused by dropped packets. Rewriters are not thread-safe. If multiple threads access a rewriter concurrently, it must be synchronized externally.
    Author:
    Maryam Daneshi, George Politis
    • Constructor Detail

      • ResumableStreamRewriter

        public ResumableStreamRewriter()
    • Method Detail

      • rewriteRTP

        public boolean rewriteRTP​(boolean accept,
                                  byte[] buf,
                                  int off,
                                  int len)
        Rewrites the sequence number of the RTP packet in the byte buffer, hiding any gaps caused by drops.
        Parameters:
        accept - true if the packet is accepted, false otherwise
        buf - the byte buffer that contains the RTP packet
        off - the offset in the byte buffer where the RTP packet starts
        len - the length of the RTP packet in the byte buffer
        Returns:
        true if the packet was altered, false otherwise
      • processRTCP

        public boolean processRTCP​(boolean rewrite,
                                   byte[] buf,
                                   int off,
                                   int len)
        Restores the RTP timestamp of the RTCP SR packet in the buffer.
        Parameters:
        buf - the byte buffer that contains the RTCP packet.
        off - the offset in the byte buffer where the RTCP packet starts.
        len - the number of bytes in buffer which constitute the actual data.
        Returns:
        true if the SR is modified, false otherwise.