Class AudioPacket


  • public class AudioPacket
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      AudioPacket​(byte[] audioFrame, int ssrc, char sequence, int timestamp)
      Creates a new audio packet.
      AudioPacket​(int ssrc, char sequence, int timestamp)
      Creates a new silent audio packet.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.net.DatagramPacket asUdpPacket​(java.net.InetSocketAddress address)
      Creates a DatagramPacket, ready to be sent.
      void encrypt​(byte[] key)
      Encrypts the audio packet with the given key.
      boolean isEncrypted()
      Checks if the audio packet has been encrypted using the encrypt(byte[]) method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AudioPacket

        public AudioPacket​(int ssrc,
                           char sequence,
                           int timestamp)
        Creates a new silent audio packet.
        Parameters:
        ssrc - The ssrc.
        sequence - The sequence.
        timestamp - The timestamp.
      • AudioPacket

        public AudioPacket​(byte[] audioFrame,
                           int ssrc,
                           char sequence,
                           int timestamp)
        Creates a new audio packet.
        Parameters:
        audioFrame - A byte array containing 20ms of audio
        ssrc - The ssrc.
        sequence - The sequence.
        timestamp - The timestamp.
    • Method Detail

      • encrypt

        public void encrypt​(byte[] key)
        Encrypts the audio packet with the given key.
        Parameters:
        key - The key used to encrypt the packet.
      • asUdpPacket

        public java.net.DatagramPacket asUdpPacket​(java.net.InetSocketAddress address)
        Creates a DatagramPacket, ready to be sent.
        Parameters:
        address - The destination address.
        Returns:
        The created datagram packet.
      • isEncrypted

        public boolean isEncrypted()
        Checks if the audio packet has been encrypted using the encrypt(byte[]) method.
        Returns:
        Whether the audio packet is encrypted or not.