fn parse_aac_sampling_frequency(codec_extra: &[u8]) -> u32 {
        if codec_extra.len() != 6 {
            fx_log_warn!("Invalid AAC codec extra length: {:?}", codec_extra.len());
            return DEFAULT_SAMPLE_RATE;
        }

        // AACMediaCodecInfo is represented as 8 bytes, with lower 6 bytes containing
        // the codec extra data.
        let mut codec_info_bytes = [0_u8; 8];
        let codec_info_slice = &mut codec_info_bytes[2..8];

        codec_info_slice.copy_from_slice(&codec_extra);

        let codec_info = AACMediaCodecInfo(u64::from_be_bytes(codec_info_bytes));
        let sample_freq = AACSamplingFrequency::from_bits_truncate(codec_info.sampling_frequency());

        match sample_freq {
            AACSamplingFrequency::FREQ48000HZ => 48000,
            AACSamplingFrequency::FREQ44100HZ => 44100,
            _ => {
                fx_log_warn!("Invalid sample_freq set in configuration {:?}", sample_freq);
                DEFAULT_SAMPLE_RATE
            }
        }
    }
/// Extract sampling frequency from AAC codec extra data field
/// (A2DP Sec. 4.5.2)
Extract sampling frequency from AAC codec extra data field
(A2DP Sec.
Extract sampling frequency from AAC codec extra data field ( A2DP Sec .
fn parse_aac_sampling_frequency(codec_extra: &[u8]) -> u32 {
        if codec_extra.len() != 6 {
            fx_log_warn!("Invalid AAC codec extra length: {:?}", codec_extra.len());
            return DEFAULT_SAMPLE_RATE;
        }
        // AACMediaCodecInfo is represented as 8 bytes, with lower 6 bytes containing
        // the codec extra data.
        let mut codec_info_bytes = [0_u8; 8];
        let codec_info_slice = &mut codec_info_bytes[2..8];
        codec_info_slice.copy_from_slice(&codec_extra);
        let codec_info = AACMediaCodecInfo(u64::from_be_bytes(codec_info_bytes));
        let sample_freq = AACSamplingFrequency::from_bits_truncate(codec_info.sampling_frequency());
        match sample_freq {
            AACSamplingFrequency::FREQ48000HZ => 48000,
            AACSamplingFrequency::FREQ44100HZ => 44100,
            _ => {
                fx_log_warn!("Invalid sample_freq set in configuration {:?}", sample_freq);
                DEFAULT_SAMPLE_RATE
            }
        }
    }
fn parse_aac_sampling_frequency ( codec_extra : & [ u8 ] ) -> u32 { if codec_extra . len ( ) != 6 { fx_log_warn ! ( " " codec_extra len ( ) ) ; return DEFAULT_SAMPLE_RATE ; } // AACMediaCodecInfo is represented as 8 bytes, with lower 6 bytes containing // the codec extra data. let mut codec_info_bytes = [ 0_u8 ; 8 ] ; let codec_info_slice = & mut codec_info_bytes [ 2 .. 8 ] ; codec_info_slice . copy_from_slice ( & codec_extra ) ; let codec_info = AACMediaCodecInfo ( u64 :: from_be_bytes ( codec_info_bytes ) ) ; let sample_freq = AACSamplingFrequency :: from_bits_truncate ( codec_info . sampling_frequency ( ) ) ; match sample_freq { AACSamplingFrequency :: FREQ48000HZ => 48000 , AACSamplingFrequency :: FREQ44100HZ => 44100 , _ => { fx_log_warn ! ( " " sample_freq ) ; DEFAULT_SAMPLE_RATE } } }
Extract sampling frequency from AAC codec extra data field
(A2DP Sec.
Extract sampling frequency from AAC codec extra data field ( A2DP Sec .
codec_extra
&[u8]