Loading system/audio_hal_interface/aidl/le_audio_software_aidl.cc +3 −3 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ using ::bluetooth::audio::le_audio::LeAudioClientInterface; using ::bluetooth::audio::le_audio::StartRequestState; using ::bluetooth::audio::le_audio::StreamCallbacks; using ::le_audio::set_configurations::SetConfiguration; using ::le_audio::types::LeAudioLc3Config; using ::le_audio::types::LeAudioCoreCodecConfig; static ChannelMode le_audio_channel_mode2audio_hal(uint8_t channels_count) { switch (channels_count) { Loading Loading @@ -502,7 +502,7 @@ bool hal_ucast_capability_to_stack_format( stack_capability = { .id = ::le_audio::set_configurations::LeAudioCodecIdLc3, .config = LeAudioLc3Config( .config = LeAudioCoreCodecConfig( {.sampling_frequency = sampling_freq_map[sample_rate_hz], .frame_duration = frame_duration_map[frame_duration_us], .audio_channel_allocation = audio_location_map[supported_channel], Loading Loading @@ -556,7 +556,7 @@ bool hal_bcast_capability_to_stack_format( stack_capability = { .id = ::le_audio::set_configurations::LeAudioCodecIdLc3, .config = LeAudioLc3Config( .config = LeAudioCoreCodecConfig( {.sampling_frequency = sampling_freq_map[sample_rate_hz], .frame_duration = frame_duration_map[frame_duration_us], .audio_channel_allocation = audio_location_map[supported_channel], Loading system/bta/le_audio/client.cc +17 −17 Original line number Diff line number Diff line Loading @@ -3116,7 +3116,7 @@ class LeAudioClientImpl : public LeAudioClient { void PrepareAndSendToTwoCises( const std::vector<uint8_t>& data, struct le_audio::stream_configuration* stream_conf) { const struct le_audio::stream_parameters& stream_params) { uint16_t left_cis_handle = 0; uint16_t right_cis_handle = 0; Loading @@ -3132,16 +3132,14 @@ class LeAudioClientImpl : public LeAudioClient { return; } for (auto [cis_handle, audio_location] : stream_conf->stream_params.sink.stream_locations) { for (auto [cis_handle, audio_location] : stream_params.stream_locations) { if (audio_location & le_audio::codec_spec_conf::kLeAudioLocationAnyLeft) left_cis_handle = cis_handle; if (audio_location & le_audio::codec_spec_conf::kLeAudioLocationAnyRight) right_cis_handle = cis_handle; } uint16_t byte_count = stream_conf->stream_params.sink.octets_per_codec_frame; uint16_t byte_count = stream_params.octets_per_codec_frame; bool mix_to_mono = (left_cis_handle == 0) || (right_cis_handle == 0); if (mix_to_mono) { std::vector<uint8_t> mono = mono_blend( Loading Loading @@ -3176,10 +3174,9 @@ class LeAudioClientImpl : public LeAudioClient { void PrepareAndSendToSingleCis( const std::vector<uint8_t>& data, struct le_audio::stream_configuration* stream_conf) { uint16_t num_channels = stream_conf->stream_params.sink.num_of_channels; uint16_t cis_handle = stream_conf->stream_params.sink.stream_locations.front().first; const struct le_audio::stream_parameters& stream_params) { uint16_t num_channels = stream_params.num_of_channels; uint16_t cis_handle = stream_params.stream_locations.front().first; uint16_t number_of_required_samples_per_channel = sw_enc_left->GetNumOfSamplesPerChannel(); Loading @@ -3190,8 +3187,7 @@ class LeAudioClientImpl : public LeAudioClient { return; } uint16_t byte_count = stream_conf->stream_params.sink.octets_per_codec_frame; uint16_t byte_count = stream_params.octets_per_codec_frame; bool mix_to_mono = (num_channels == 1); if (mix_to_mono) { /* Since we always get two channels from framework, lets make it mono here Loading Loading @@ -3246,10 +3242,10 @@ class LeAudioClientImpl : public LeAudioClient { if ((stream_conf.stream_params.sink.num_of_devices == 2) || (stream_conf.stream_params.sink.stream_locations.size() == 2)) { /* Streaming to two devices or one device with 2 CISes */ PrepareAndSendToTwoCises(data, &stream_conf); PrepareAndSendToTwoCises(data, stream_conf.stream_params.sink); } else { /* Streaming to one device and 1 CIS */ PrepareAndSendToSingleCis(data, &stream_conf); PrepareAndSendToSingleCis(data, stream_conf.stream_params.sink); } } Loading Loading @@ -3455,7 +3451,8 @@ class LeAudioClientImpl : public LeAudioClient { LOG(WARNING) << " The encoder instance should have been already released."; } sw_enc_left = le_audio::CodecInterface::CreateInstance(stream_conf->id); sw_enc_left = le_audio::CodecInterface::CreateInstance(stream_conf->codec_id); auto codec_status = sw_enc_left->InitEncoder( audio_framework_source_config, current_source_codec_config); if (codec_status != le_audio::CodecInterface::Status::STATUS_OK) { Loading @@ -3463,7 +3460,8 @@ class LeAudioClientImpl : public LeAudioClient { return false; } sw_enc_right = le_audio::CodecInterface::CreateInstance(stream_conf->id); sw_enc_right = le_audio::CodecInterface::CreateInstance(stream_conf->codec_id); codec_status = sw_enc_right->InitEncoder(audio_framework_source_config, current_source_codec_config); if (codec_status != le_audio::CodecInterface::Status::STATUS_OK) { Loading Loading @@ -3527,7 +3525,8 @@ class LeAudioClientImpl : public LeAudioClient { LOG(WARNING) << " The decoder instance should have been already released."; } sw_dec_left = le_audio::CodecInterface::CreateInstance(stream_conf->id); sw_dec_left = le_audio::CodecInterface::CreateInstance(stream_conf->codec_id); auto codec_status = sw_dec_left->InitDecoder(current_sink_codec_config, audio_framework_sink_config); if (codec_status != le_audio::CodecInterface::Status::STATUS_OK) { Loading @@ -3535,7 +3534,8 @@ class LeAudioClientImpl : public LeAudioClient { return; } sw_dec_right = le_audio::CodecInterface::CreateInstance(stream_conf->id); sw_dec_right = le_audio::CodecInterface::CreateInstance(stream_conf->codec_id); codec_status = sw_dec_right->InitDecoder(current_sink_codec_config, audio_framework_sink_config); if (codec_status != le_audio::CodecInterface::Status::STATUS_OK) { Loading system/bta/le_audio/codec_manager.cc +10 −10 Original line number Diff line number Diff line Loading @@ -186,15 +186,15 @@ struct codec_manager_impl { continue; } auto& adsp_config = adsp_audio_set_conf.confs[0]; const types::LeAudioLc3Config lc3_config = std::get<types::LeAudioLc3Config>(adsp_config.codec.config); const types::LeAudioCoreCodecConfig core_config = std::get<types::LeAudioCoreCodecConfig>(adsp_config.codec.config); le_audio::broadcast_offload_config broadcast_config; broadcast_config.stream_map.resize(lc3_config.channel_count); broadcast_config.stream_map.resize(core_config.channel_count); broadcast_config.bits_per_sample = LeAudioCodecConfiguration::kBitsPerSample16; broadcast_config.sampling_rate = lc3_config.GetSamplingFrequencyHz(); broadcast_config.frame_duration = lc3_config.GetFrameDurationUs(); broadcast_config.octets_per_frame = *(lc3_config.octets_per_codec_frame); broadcast_config.sampling_rate = core_config.GetSamplingFrequencyHz(); broadcast_config.frame_duration = core_config.GetFrameDurationUs(); broadcast_config.octets_per_frame = *(core_config.octets_per_codec_frame); broadcast_config.blocks_per_sdu = 1; // Per LC3 spec, bitrate = (8000 * nbytes) / (frame duration in // milliseconds) Loading Loading @@ -396,10 +396,10 @@ struct codec_manager_impl { return false; } const types::LeAudioLc3Config adsp_lc3_config = std::get<types::LeAudioLc3Config>(adsp_config.config); const types::LeAudioLc3Config target_lc3_config = std::get<types::LeAudioLc3Config>(target_config.config); const types::LeAudioCoreCodecConfig adsp_lc3_config = std::get<types::LeAudioCoreCodecConfig>(adsp_config.config); const types::LeAudioCoreCodecConfig target_lc3_config = std::get<types::LeAudioCoreCodecConfig>(target_config.config); if (adsp_lc3_config.sampling_frequency != target_lc3_config.sampling_frequency || Loading system/bta/le_audio/device_groups.cc +4 −3 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ using types::CisState; using types::CisType; using types::DataPathState; using types::LeAudioContextType; using types::LeAudioLc3Config; using types::LeAudioCoreCodecConfig; /* LeAudioDeviceGroup Class methods implementation */ void LeAudioDeviceGroup::AddNode( Loading Loading @@ -1304,7 +1304,8 @@ bool LeAudioDeviceGroup::IsAudioSetConfigurationSupported( /* TODO Make it no Lc3 specific */ if (!CheckIfStrategySupported( strategy, audio_locations, std::get<LeAudioLc3Config>(ent.codec.config).GetChannelCount(), std::get<LeAudioCoreCodecConfig>(ent.codec.config) .GetChannelCount(), device->GetLc3SupportedChannelCount(ent.direction))) { LOG_DEBUG(" insufficient device audio allocation: %lu", audio_locations.to_ulong()); Loading Loading @@ -1960,7 +1961,7 @@ void LeAudioDeviceGroup::Dump(int fd, int active_group_id) const { << " stream configuration: " << (stream_conf.conf != nullptr ? stream_conf.conf->name : " unknown ") << "\n" << " codec id: " << +(stream_conf.id.coding_format) << " codec id: " << +(stream_conf.codec_id.coding_format) << ",\tpending_configuration: " << stream_conf.pending_configuration << "\n" << " num of devices(connected): " << Size() << "(" Loading system/bta/le_audio/device_groups.h +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ class LeAudioDeviceGroup { types::CigState state_; } cig; /* Current audio stream configuration */ struct stream_configuration stream_conf; uint8_t audio_directions_; Loading Loading
system/audio_hal_interface/aidl/le_audio_software_aidl.cc +3 −3 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ using ::bluetooth::audio::le_audio::LeAudioClientInterface; using ::bluetooth::audio::le_audio::StartRequestState; using ::bluetooth::audio::le_audio::StreamCallbacks; using ::le_audio::set_configurations::SetConfiguration; using ::le_audio::types::LeAudioLc3Config; using ::le_audio::types::LeAudioCoreCodecConfig; static ChannelMode le_audio_channel_mode2audio_hal(uint8_t channels_count) { switch (channels_count) { Loading Loading @@ -502,7 +502,7 @@ bool hal_ucast_capability_to_stack_format( stack_capability = { .id = ::le_audio::set_configurations::LeAudioCodecIdLc3, .config = LeAudioLc3Config( .config = LeAudioCoreCodecConfig( {.sampling_frequency = sampling_freq_map[sample_rate_hz], .frame_duration = frame_duration_map[frame_duration_us], .audio_channel_allocation = audio_location_map[supported_channel], Loading Loading @@ -556,7 +556,7 @@ bool hal_bcast_capability_to_stack_format( stack_capability = { .id = ::le_audio::set_configurations::LeAudioCodecIdLc3, .config = LeAudioLc3Config( .config = LeAudioCoreCodecConfig( {.sampling_frequency = sampling_freq_map[sample_rate_hz], .frame_duration = frame_duration_map[frame_duration_us], .audio_channel_allocation = audio_location_map[supported_channel], Loading
system/bta/le_audio/client.cc +17 −17 Original line number Diff line number Diff line Loading @@ -3116,7 +3116,7 @@ class LeAudioClientImpl : public LeAudioClient { void PrepareAndSendToTwoCises( const std::vector<uint8_t>& data, struct le_audio::stream_configuration* stream_conf) { const struct le_audio::stream_parameters& stream_params) { uint16_t left_cis_handle = 0; uint16_t right_cis_handle = 0; Loading @@ -3132,16 +3132,14 @@ class LeAudioClientImpl : public LeAudioClient { return; } for (auto [cis_handle, audio_location] : stream_conf->stream_params.sink.stream_locations) { for (auto [cis_handle, audio_location] : stream_params.stream_locations) { if (audio_location & le_audio::codec_spec_conf::kLeAudioLocationAnyLeft) left_cis_handle = cis_handle; if (audio_location & le_audio::codec_spec_conf::kLeAudioLocationAnyRight) right_cis_handle = cis_handle; } uint16_t byte_count = stream_conf->stream_params.sink.octets_per_codec_frame; uint16_t byte_count = stream_params.octets_per_codec_frame; bool mix_to_mono = (left_cis_handle == 0) || (right_cis_handle == 0); if (mix_to_mono) { std::vector<uint8_t> mono = mono_blend( Loading Loading @@ -3176,10 +3174,9 @@ class LeAudioClientImpl : public LeAudioClient { void PrepareAndSendToSingleCis( const std::vector<uint8_t>& data, struct le_audio::stream_configuration* stream_conf) { uint16_t num_channels = stream_conf->stream_params.sink.num_of_channels; uint16_t cis_handle = stream_conf->stream_params.sink.stream_locations.front().first; const struct le_audio::stream_parameters& stream_params) { uint16_t num_channels = stream_params.num_of_channels; uint16_t cis_handle = stream_params.stream_locations.front().first; uint16_t number_of_required_samples_per_channel = sw_enc_left->GetNumOfSamplesPerChannel(); Loading @@ -3190,8 +3187,7 @@ class LeAudioClientImpl : public LeAudioClient { return; } uint16_t byte_count = stream_conf->stream_params.sink.octets_per_codec_frame; uint16_t byte_count = stream_params.octets_per_codec_frame; bool mix_to_mono = (num_channels == 1); if (mix_to_mono) { /* Since we always get two channels from framework, lets make it mono here Loading Loading @@ -3246,10 +3242,10 @@ class LeAudioClientImpl : public LeAudioClient { if ((stream_conf.stream_params.sink.num_of_devices == 2) || (stream_conf.stream_params.sink.stream_locations.size() == 2)) { /* Streaming to two devices or one device with 2 CISes */ PrepareAndSendToTwoCises(data, &stream_conf); PrepareAndSendToTwoCises(data, stream_conf.stream_params.sink); } else { /* Streaming to one device and 1 CIS */ PrepareAndSendToSingleCis(data, &stream_conf); PrepareAndSendToSingleCis(data, stream_conf.stream_params.sink); } } Loading Loading @@ -3455,7 +3451,8 @@ class LeAudioClientImpl : public LeAudioClient { LOG(WARNING) << " The encoder instance should have been already released."; } sw_enc_left = le_audio::CodecInterface::CreateInstance(stream_conf->id); sw_enc_left = le_audio::CodecInterface::CreateInstance(stream_conf->codec_id); auto codec_status = sw_enc_left->InitEncoder( audio_framework_source_config, current_source_codec_config); if (codec_status != le_audio::CodecInterface::Status::STATUS_OK) { Loading @@ -3463,7 +3460,8 @@ class LeAudioClientImpl : public LeAudioClient { return false; } sw_enc_right = le_audio::CodecInterface::CreateInstance(stream_conf->id); sw_enc_right = le_audio::CodecInterface::CreateInstance(stream_conf->codec_id); codec_status = sw_enc_right->InitEncoder(audio_framework_source_config, current_source_codec_config); if (codec_status != le_audio::CodecInterface::Status::STATUS_OK) { Loading Loading @@ -3527,7 +3525,8 @@ class LeAudioClientImpl : public LeAudioClient { LOG(WARNING) << " The decoder instance should have been already released."; } sw_dec_left = le_audio::CodecInterface::CreateInstance(stream_conf->id); sw_dec_left = le_audio::CodecInterface::CreateInstance(stream_conf->codec_id); auto codec_status = sw_dec_left->InitDecoder(current_sink_codec_config, audio_framework_sink_config); if (codec_status != le_audio::CodecInterface::Status::STATUS_OK) { Loading @@ -3535,7 +3534,8 @@ class LeAudioClientImpl : public LeAudioClient { return; } sw_dec_right = le_audio::CodecInterface::CreateInstance(stream_conf->id); sw_dec_right = le_audio::CodecInterface::CreateInstance(stream_conf->codec_id); codec_status = sw_dec_right->InitDecoder(current_sink_codec_config, audio_framework_sink_config); if (codec_status != le_audio::CodecInterface::Status::STATUS_OK) { Loading
system/bta/le_audio/codec_manager.cc +10 −10 Original line number Diff line number Diff line Loading @@ -186,15 +186,15 @@ struct codec_manager_impl { continue; } auto& adsp_config = adsp_audio_set_conf.confs[0]; const types::LeAudioLc3Config lc3_config = std::get<types::LeAudioLc3Config>(adsp_config.codec.config); const types::LeAudioCoreCodecConfig core_config = std::get<types::LeAudioCoreCodecConfig>(adsp_config.codec.config); le_audio::broadcast_offload_config broadcast_config; broadcast_config.stream_map.resize(lc3_config.channel_count); broadcast_config.stream_map.resize(core_config.channel_count); broadcast_config.bits_per_sample = LeAudioCodecConfiguration::kBitsPerSample16; broadcast_config.sampling_rate = lc3_config.GetSamplingFrequencyHz(); broadcast_config.frame_duration = lc3_config.GetFrameDurationUs(); broadcast_config.octets_per_frame = *(lc3_config.octets_per_codec_frame); broadcast_config.sampling_rate = core_config.GetSamplingFrequencyHz(); broadcast_config.frame_duration = core_config.GetFrameDurationUs(); broadcast_config.octets_per_frame = *(core_config.octets_per_codec_frame); broadcast_config.blocks_per_sdu = 1; // Per LC3 spec, bitrate = (8000 * nbytes) / (frame duration in // milliseconds) Loading Loading @@ -396,10 +396,10 @@ struct codec_manager_impl { return false; } const types::LeAudioLc3Config adsp_lc3_config = std::get<types::LeAudioLc3Config>(adsp_config.config); const types::LeAudioLc3Config target_lc3_config = std::get<types::LeAudioLc3Config>(target_config.config); const types::LeAudioCoreCodecConfig adsp_lc3_config = std::get<types::LeAudioCoreCodecConfig>(adsp_config.config); const types::LeAudioCoreCodecConfig target_lc3_config = std::get<types::LeAudioCoreCodecConfig>(target_config.config); if (adsp_lc3_config.sampling_frequency != target_lc3_config.sampling_frequency || Loading
system/bta/le_audio/device_groups.cc +4 −3 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ using types::CisState; using types::CisType; using types::DataPathState; using types::LeAudioContextType; using types::LeAudioLc3Config; using types::LeAudioCoreCodecConfig; /* LeAudioDeviceGroup Class methods implementation */ void LeAudioDeviceGroup::AddNode( Loading Loading @@ -1304,7 +1304,8 @@ bool LeAudioDeviceGroup::IsAudioSetConfigurationSupported( /* TODO Make it no Lc3 specific */ if (!CheckIfStrategySupported( strategy, audio_locations, std::get<LeAudioLc3Config>(ent.codec.config).GetChannelCount(), std::get<LeAudioCoreCodecConfig>(ent.codec.config) .GetChannelCount(), device->GetLc3SupportedChannelCount(ent.direction))) { LOG_DEBUG(" insufficient device audio allocation: %lu", audio_locations.to_ulong()); Loading Loading @@ -1960,7 +1961,7 @@ void LeAudioDeviceGroup::Dump(int fd, int active_group_id) const { << " stream configuration: " << (stream_conf.conf != nullptr ? stream_conf.conf->name : " unknown ") << "\n" << " codec id: " << +(stream_conf.id.coding_format) << " codec id: " << +(stream_conf.codec_id.coding_format) << ",\tpending_configuration: " << stream_conf.pending_configuration << "\n" << " num of devices(connected): " << Size() << "(" Loading
system/bta/le_audio/device_groups.h +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ class LeAudioDeviceGroup { types::CigState state_; } cig; /* Current audio stream configuration */ struct stream_configuration stream_conf; uint8_t audio_directions_; Loading