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

        let mut codec_info_bytes = [0_u8; 4];
        codec_info_bytes.copy_from_slice(&codec_extra);

        let codec_info = SbcCodecInfo(u32::from_be_bytes(codec_info_bytes));
        let sample_freq = SbcSamplingFrequency::from_bits_truncate(codec_info.sampling_frequency());

        match sample_freq {
            SbcSamplingFrequency::FREQ48000HZ => 48000,
            SbcSamplingFrequency::FREQ44100HZ => 44100,
            _ => {
                fx_log_warn!("Invalid sample_freq set in configuration {:?}", sample_freq);
                DEFAULT_SAMPLE_RATE
            }
        }
    }
/// Extract sampling freqency from SBC codec extra data field
/// (A2DP Sec. 4.3.2)
Extract sampling freqency from SBC codec extra data field
(A2DP Sec.
Extract sampling freqency from SBC codec extra data field ( A2DP Sec .
fn parse_sbc_sampling_frequency(codec_extra: &[u8]) -> u32 {
        if codec_extra.len() != 4 {
            fx_log_warn!("Invalid SBC codec extra length: {:?}", codec_extra.len());
            return DEFAULT_SAMPLE_RATE;
        }
        let mut codec_info_bytes = [0_u8; 4];
        codec_info_bytes.copy_from_slice(&codec_extra);
        let codec_info = SbcCodecInfo(u32::from_be_bytes(codec_info_bytes));
        let sample_freq = SbcSamplingFrequency::from_bits_truncate(codec_info.sampling_frequency());
        match sample_freq {
            SbcSamplingFrequency::FREQ48000HZ => 48000,
            SbcSamplingFrequency::FREQ44100HZ => 44100,
            _ => {
                fx_log_warn!("Invalid sample_freq set in configuration {:?}", sample_freq);
                DEFAULT_SAMPLE_RATE
            }
        }
    }
fn parse_sbc_sampling_frequency ( codec_extra : & [ u8 ] ) -> u32 { if codec_extra . len ( ) != 4 { fx_log_warn ! ( " " codec_extra len ( ) ) ; return DEFAULT_SAMPLE_RATE ; } let mut codec_info_bytes = [ 0_u8 ; 4 ] ; codec_info_bytes . copy_from_slice ( & codec_extra ) ; let codec_info = SbcCodecInfo ( u32 :: from_be_bytes ( codec_info_bytes ) ) ; let sample_freq = SbcSamplingFrequency :: from_bits_truncate ( codec_info . sampling_frequency ( ) ) ; match sample_freq { SbcSamplingFrequency :: FREQ48000HZ => 48000 , SbcSamplingFrequency :: FREQ44100HZ => 44100 , _ => { fx_log_warn ! ( " " sample_freq ) ; DEFAULT_SAMPLE_RATE } } }
Extract sampling freqency from SBC codec extra data field
(A2DP Sec.
Extract sampling freqency from SBC codec extra data field ( A2DP Sec .
codec_extra
&[u8]