/// Builds the set of streams which we currently support.
Builds the set of streams which we currently support.
Builds the set of streams which we currently support .
pub(crate) fn build_local_streams() -> avdtp::Result<stream::Streams> {
    // TODO(BT-533): detect codecs, add streams for each codec
    let mut streams = stream::Streams::new();
    let sbc_codec_info = SbcCodecInfo::new(
        SbcSamplingFrequency::FREQ48000HZ,
        SbcChannelMode::JOINT_STEREO,
        SbcBlockCount::MANDATORY_SRC,
        SbcSubBands::MANDATORY_SRC,
        SbcAllocation::MANDATORY_SRC,
        SbcCodecInfo::BITPOOL_MIN,
        SbcCodecInfo::BITPOOL_MAX,
    )?;
    fx_vlog!(1, "Supported SBC codec parameters: {:?}.", sbc_codec_info);
    let sbc_endpoint = avdtp::StreamEndpoint::new(
        SBC_SEID,
        avdtp::MediaType::Audio,
        avdtp::EndpointType::Source,
        vec![
            avdtp::ServiceCapability::MediaTransport,
            avdtp::ServiceCapability::MediaCodec {
                media_type: avdtp::MediaType::Audio,
                codec_type: avdtp::MediaCodecType::AUDIO_SBC,
                codec_extra: sbc_codec_info.to_bytes().to_vec(),
            },
        ],
    )?;
    streams.insert(stream::Stream::build(sbc_endpoint));
    fx_vlog!(1, "SBC Stream added at SEID {}", SBC_SEID);
    let aac_codec_info = AacCodecInfo::new(
        AacObjectType::MANDATORY_SRC,
        AacSamplingFrequency::FREQ48000HZ,
        AacChannels::TWO,
        true,
        MAX_BITRATE_AAC,
    )?;
    fx_vlog!(1, "Supported AAC codec parameters: {:?}.", aac_codec_info);
    let aac_endpoint = avdtp::StreamEndpoint::new(
        AAC_SEID,
        avdtp::MediaType::Audio,
        avdtp::EndpointType::Source,
        vec![
            avdtp::ServiceCapability::MediaTransport,
            avdtp::ServiceCapability::MediaCodec {
                media_type: avdtp::MediaType::Audio,
                codec_type: avdtp::MediaCodecType::AUDIO_AAC,
                codec_extra: aac_codec_info.to_bytes().to_vec(),
            },
        ],
    )?;
    streams.insert(stream::Stream::build(aac_endpoint));
    fx_vlog!(1, "AAC stream added at SEID {}", AAC_SEID);
    Ok(streams)
}
pub ( crate ) fn build_local_streams ( ) -> avdtp :: Result < stream :: Streams > { // TODO(BT-533): detect codecs, add streams for each codec let mut streams = stream :: Streams :: new ( ) ; let sbc_codec_info = SbcCodecInfo :: new ( SbcSamplingFrequency :: FREQ48000HZ , SbcChannelMode :: JOINT_STEREO , SbcBlockCount :: MANDATORY_SRC , SbcSubBands :: MANDATORY_SRC , SbcAllocation :: MANDATORY_SRC , SbcCodecInfo :: BITPOOL_MIN , SbcCodecInfo :: BITPOOL_MAX , ) ? ; fx_vlog ! ( 1 " " sbc_codec_info ) ; let sbc_endpoint = avdtp :: StreamEndpoint :: new ( SBC_SEID , avdtp :: MediaType :: Audio , avdtp :: EndpointType :: Source , vec ! [ avdtp ServiceCapability MediaTransport avdtp ServiceCapability MediaCodec { media_type avdtp MediaType Audio codec_type avdtp MediaCodecType AUDIO_SBC codec_extra sbc_codec_info to_bytes ( ) to_vec ( ) } ] , ) ? ; streams . insert ( stream :: Stream :: build ( sbc_endpoint ) ) ; fx_vlog ! ( 1 " " SBC_SEID ) ; let aac_codec_info = AacCodecInfo :: new ( AacObjectType :: MANDATORY_SRC , AacSamplingFrequency :: FREQ48000HZ , AacChannels :: TWO , true , MAX_BITRATE_AAC , ) ? ; fx_vlog ! ( 1 " " aac_codec_info ) ; let aac_endpoint = avdtp :: StreamEndpoint :: new ( AAC_SEID , avdtp :: MediaType :: Audio , avdtp :: EndpointType :: Source , vec ! [ avdtp ServiceCapability MediaTransport avdtp ServiceCapability MediaCodec { media_type avdtp MediaType Audio codec_type avdtp MediaCodecType AUDIO_AAC codec_extra aac_codec_info to_bytes ( ) to_vec ( ) } ] , ) ? ; streams . insert ( stream :: Stream :: build ( aac_endpoint ) ) ; fx_vlog ! ( 1 " " AAC_SEID ) ; Ok ( streams ) }
Builds the set of streams which we currently support.
Builds the set of streams which we currently support .