Class AudioPacket

java.lang.Object
net.dv8tion.jda.internal.audio.AudioPacket

public class AudioPacket extends Object
Represents the contents of a audio packet that was either received from Discord or will be sent to discord.
See Also:
  • Field Details

    • RTP_HEADER_BYTE_LENGTH

      public static final int RTP_HEADER_BYTE_LENGTH
      See Also:
    • RTP_VERSION_PAD_EXTEND

      public static final byte RTP_VERSION_PAD_EXTEND
      Bit index 0 and 1 represent the RTP Protocol version used. Discord uses the latest RTP protocol version, 2.
      Bit index 2 represents whether or not we pad. Opus uses an internal padding system, so RTP padding is not used.
      Bit index 3 represents if we use extensions.
      Bit index 4 to 7 represent the CC or CSRC count. CSRC is Combined SSRC.
      See Also:
    • RTP_PAYLOAD_TYPE

      public static final byte RTP_PAYLOAD_TYPE
      This is Discord's RTP Profile Payload type.
      I've yet to find actual documentation on what the bits inside this value represent.
      See Also:
  • Constructor Details

    • AudioPacket

      public AudioPacket(DatagramPacket packet)
    • AudioPacket

      public AudioPacket(byte[] rawPacket)
    • AudioPacket

      public AudioPacket(ByteBuffer buffer, char seq, int timestamp, int ssrc, ByteBuffer encodedAudio)
  • Method Details

    • getHeader

      public byte[] getHeader()
    • getEncodedAudio

      public ByteBuffer getEncodedAudio()
    • getSequence

      public char getSequence()
    • getSSRC

      public int getSSRC()
    • getTimestamp

      public int getTimestamp()
    • asEncryptedPacket

      public ByteBuffer asEncryptedPacket(CryptoAdapter crypto, ByteBuffer buffer)
    • decryptAudioPacket

      public static AudioPacket decryptAudioPacket(CryptoAdapter crypto, DatagramPacket packet)