Class OpusUtil


  • public class OpusUtil
    extends Object
    Utility methods for handling Opus audio streams.
    • Field Detail

      • SAMPLE_RATE

        public static final int SAMPLE_RATE
        Opus streams are always 48000 Hz.
        See Also:
        Constant Field Values
    • Method Detail

      • getChannelCount

        public static int getChannelCount​(byte[] header)
        Parses the channel count from an Opus Identification Header.
        Parameters:
        header - An Opus Identification Header, as defined by RFC 7845.
        Returns:
        The parsed channel count.
      • buildInitializationData

        public static List<byte[]> buildInitializationData​(byte[] header)
        Builds codec initialization data from an Opus Identification Header.
        Parameters:
        header - An Opus Identification Header, as defined by RFC 7845.
        Returns:
        Codec initialization data suitable for an Opus MediaCodec.