Loading system/bta/le_audio/devices.cc +16 −15 Original line number Diff line number Diff line Loading @@ -802,7 +802,8 @@ bool LeAudioDeviceGroup::UpdateAudioContextTypeAvailability( } LOG_INFO( "updated context: %s, %s -> %s", ToHexString(ctx_type).c_str(), "%s(%s), %s -> %s", types::contextTypeToStr(ctx_type).c_str(), ToHexString(ctx_type).c_str(), (ctx_previously_not_supported ? "empty" : available_context_to_configuration_map[ctx_type]->name.c_str()), Loading Loading @@ -908,7 +909,7 @@ uint8_t LeAudioDeviceGroup::GetFirstFreeCisId(void) { } uint8_t LeAudioDeviceGroup::GetFirstFreeCisId(CisType cis_type) { LOG_DEBUG("Group: %p, group_id: %d cis_type: %d", this, group_id_, LOG_INFO("Group: %p, group_id: %d cis_type: %d", this, group_id_, static_cast<int>(cis_type)); for (size_t id = 0; id < cises_.size(); id++) { if (cises_[id].addr.IsEmpty() && cises_[id].type == cis_type) { Loading @@ -920,12 +921,12 @@ uint8_t LeAudioDeviceGroup::GetFirstFreeCisId(CisType cis_type) { types::LeAudioConfigurationStrategy LeAudioDeviceGroup::GetGroupStrategy(void) { /* Simple strategy picker */ LOG_INFO(" Group %d size %d", group_id_, Size()); LOG_DEBUG(" Group %d size %d", group_id_, Size()); if (Size() > 1) { return types::LeAudioConfigurationStrategy::MONO_ONE_CIS_PER_DEVICE; } LOG_INFO("audio location 0x%04lx", snk_audio_locations_.to_ulong()); LOG_DEBUG("audio location 0x%04lx", snk_audio_locations_.to_ulong()); if (!(snk_audio_locations_.to_ulong() & codec_spec_conf::kLeAudioLocationAnyLeft) || !(snk_audio_locations_.to_ulong() & Loading @@ -936,7 +937,7 @@ types::LeAudioConfigurationStrategy LeAudioDeviceGroup::GetGroupStrategy(void) { auto device = GetFirstDevice(); auto channel_cnt = device->GetLc3SupportedChannelCount(types::kLeAudioDirectionSink); LOG_INFO("Channel count for group %d is %d (device %s)", group_id_, LOG_DEBUG("Channel count for group %d is %d (device %s)", group_id_, channel_cnt, ADDRESS_TO_LOGGABLE_CSTR(device->address_)); if (channel_cnt == 1) { return types::LeAudioConfigurationStrategy::STEREO_TWO_CISES_PER_DEVICE; Loading Loading @@ -1241,7 +1242,8 @@ bool CheckIfStrategySupported(types::LeAudioConfigurationStrategy strategy, */ bool LeAudioDeviceGroup::IsConfigurationSupported( const set_configurations::AudioSetConfiguration* audio_set_conf, types::LeAudioContextType context_type) { types::LeAudioContextType context_type, types::LeAudioConfigurationStrategy required_snk_strategy) { if (!set_configurations::check_if_may_cover_scenario( audio_set_conf, NumOfConnected(context_type))) { LOG_DEBUG(" cannot cover scenario %s: size of for context type %d", Loading @@ -1250,8 +1252,6 @@ bool LeAudioDeviceGroup::IsConfigurationSupported( return false; } auto required_snk_strategy = GetGroupStrategy(); /* TODO For now: set ase if matching with first pac. * 1) We assume as well that devices will match requirements in order * e.g. 1 Device - 1 Requirement, 2 Device - 2 Requirement etc. Loading @@ -1278,7 +1278,7 @@ bool LeAudioDeviceGroup::IsConfigurationSupported( if (ent.direction == types::kLeAudioDirectionSink && strategy != required_snk_strategy) { LOG_INFO(" Sink strategy mismatch group!=cfg.entry (%d!=%d)", LOG_DEBUG(" Sink strategy mismatch group!=cfg.entry (%d!=%d)", static_cast<int>(required_snk_strategy), static_cast<int>(strategy)); return false; Loading Loading @@ -1923,14 +1923,15 @@ LeAudioDeviceGroup::FindFirstSupportedConfiguration( /* Filter out device set for all scenarios */ if (!set_configurations::check_if_may_cover_scenario(confs, NumOfConnected())) { LOG_ERROR(", group is unable to cover scenario"); LOG_DEBUG(", group is unable to cover scenario"); return nullptr; } /* Filter out device set for each end every scenario */ auto required_snk_strategy = GetGroupStrategy(); for (const auto& conf : *confs) { if (IsConfigurationSupported(conf, context_type)) { if (IsConfigurationSupported(conf, context_type, required_snk_strategy)) { LOG_DEBUG("found: %s", conf->name.c_str()); return conf; } Loading system/bta/le_audio/devices.h +2 −1 Original line number Diff line number Diff line Loading @@ -390,7 +390,8 @@ class LeAudioDeviceGroup { const std::vector<uint8_t>& ccid_list); bool IsConfigurationSupported( const set_configurations::AudioSetConfiguration* audio_set_configuration, types::LeAudioContextType context_type); types::LeAudioContextType context_type, types::LeAudioConfigurationStrategy required_snk_strategy); uint32_t GetTransportLatencyUs(uint8_t direction); /* Current configuration and metadata context types */ Loading system/bta/le_audio/le_audio_types.cc +20 −29 Original line number Diff line number Diff line Loading @@ -649,51 +649,42 @@ std::ostream& operator<<(std::ostream& os, << ", AudioChanLoc=" << loghex(*config.audio_channel_allocation) << ")"; return os; } std::ostream& operator<<(std::ostream& os, const LeAudioContextType& context) { std::string contextTypeToStr(const LeAudioContextType& context) { switch (context) { case LeAudioContextType::UNINITIALIZED: os << "UNINITIALIZED"; break; return "UNINITIALIZED"; case LeAudioContextType::UNSPECIFIED: os << "UNSPECIFIED"; break; return "UNSPECIFIED"; case LeAudioContextType::CONVERSATIONAL: os << "CONVERSATIONAL"; break; return "CONVERSATIONAL"; case LeAudioContextType::MEDIA: os << "MEDIA"; break; return "MEDIA"; case LeAudioContextType::GAME: os << "GAME"; break; return "GAME"; case LeAudioContextType::INSTRUCTIONAL: os << "INSTRUCTIONAL"; break; return "INSTRUCTIONAL"; case LeAudioContextType::VOICEASSISTANTS: os << "VOICEASSISTANTS"; break; return "VOICEASSISTANTS"; case LeAudioContextType::LIVE: os << "LIVE"; break; return "LIVE"; case LeAudioContextType::SOUNDEFFECTS: os << "SOUNDEFFECTS"; break; return "SOUNDEFFECTS"; case LeAudioContextType::NOTIFICATIONS: os << "NOTIFICATIONS"; break; return "NOTIFICATIONS"; case LeAudioContextType::RINGTONE: os << "RINGTONE"; break; return "RINGTONE"; case LeAudioContextType::ALERTS: os << "ALERTS"; break; return "ALERTS"; case LeAudioContextType::EMERGENCYALARM: os << "EMERGENCYALARM"; break; return "EMERGENCYALARM"; default: os << "UNKNOWN"; break; return "UNKNOWN"; } } std::ostream& operator<<(std::ostream& os, const LeAudioContextType& context) { os << contextTypeToStr(context); return os; } Loading system/bta/le_audio/le_audio_types.h +1 −0 Original line number Diff line number Diff line Loading @@ -686,6 +686,7 @@ using AudioLocations = std::bitset<32>; std::ostream& operator<<(std::ostream& os, const AseState& state); std::ostream& operator<<(std::ostream& os, const CigState& state); std::ostream& operator<<(std::ostream& os, const LeAudioLc3Config& config); std::string contextTypeToStr(const LeAudioContextType& context); std::ostream& operator<<(std::ostream& os, const LeAudioContextType& context); std::ostream& operator<<(std::ostream& os, const AudioStreamDataPathState& state); Loading Loading
system/bta/le_audio/devices.cc +16 −15 Original line number Diff line number Diff line Loading @@ -802,7 +802,8 @@ bool LeAudioDeviceGroup::UpdateAudioContextTypeAvailability( } LOG_INFO( "updated context: %s, %s -> %s", ToHexString(ctx_type).c_str(), "%s(%s), %s -> %s", types::contextTypeToStr(ctx_type).c_str(), ToHexString(ctx_type).c_str(), (ctx_previously_not_supported ? "empty" : available_context_to_configuration_map[ctx_type]->name.c_str()), Loading Loading @@ -908,7 +909,7 @@ uint8_t LeAudioDeviceGroup::GetFirstFreeCisId(void) { } uint8_t LeAudioDeviceGroup::GetFirstFreeCisId(CisType cis_type) { LOG_DEBUG("Group: %p, group_id: %d cis_type: %d", this, group_id_, LOG_INFO("Group: %p, group_id: %d cis_type: %d", this, group_id_, static_cast<int>(cis_type)); for (size_t id = 0; id < cises_.size(); id++) { if (cises_[id].addr.IsEmpty() && cises_[id].type == cis_type) { Loading @@ -920,12 +921,12 @@ uint8_t LeAudioDeviceGroup::GetFirstFreeCisId(CisType cis_type) { types::LeAudioConfigurationStrategy LeAudioDeviceGroup::GetGroupStrategy(void) { /* Simple strategy picker */ LOG_INFO(" Group %d size %d", group_id_, Size()); LOG_DEBUG(" Group %d size %d", group_id_, Size()); if (Size() > 1) { return types::LeAudioConfigurationStrategy::MONO_ONE_CIS_PER_DEVICE; } LOG_INFO("audio location 0x%04lx", snk_audio_locations_.to_ulong()); LOG_DEBUG("audio location 0x%04lx", snk_audio_locations_.to_ulong()); if (!(snk_audio_locations_.to_ulong() & codec_spec_conf::kLeAudioLocationAnyLeft) || !(snk_audio_locations_.to_ulong() & Loading @@ -936,7 +937,7 @@ types::LeAudioConfigurationStrategy LeAudioDeviceGroup::GetGroupStrategy(void) { auto device = GetFirstDevice(); auto channel_cnt = device->GetLc3SupportedChannelCount(types::kLeAudioDirectionSink); LOG_INFO("Channel count for group %d is %d (device %s)", group_id_, LOG_DEBUG("Channel count for group %d is %d (device %s)", group_id_, channel_cnt, ADDRESS_TO_LOGGABLE_CSTR(device->address_)); if (channel_cnt == 1) { return types::LeAudioConfigurationStrategy::STEREO_TWO_CISES_PER_DEVICE; Loading Loading @@ -1241,7 +1242,8 @@ bool CheckIfStrategySupported(types::LeAudioConfigurationStrategy strategy, */ bool LeAudioDeviceGroup::IsConfigurationSupported( const set_configurations::AudioSetConfiguration* audio_set_conf, types::LeAudioContextType context_type) { types::LeAudioContextType context_type, types::LeAudioConfigurationStrategy required_snk_strategy) { if (!set_configurations::check_if_may_cover_scenario( audio_set_conf, NumOfConnected(context_type))) { LOG_DEBUG(" cannot cover scenario %s: size of for context type %d", Loading @@ -1250,8 +1252,6 @@ bool LeAudioDeviceGroup::IsConfigurationSupported( return false; } auto required_snk_strategy = GetGroupStrategy(); /* TODO For now: set ase if matching with first pac. * 1) We assume as well that devices will match requirements in order * e.g. 1 Device - 1 Requirement, 2 Device - 2 Requirement etc. Loading @@ -1278,7 +1278,7 @@ bool LeAudioDeviceGroup::IsConfigurationSupported( if (ent.direction == types::kLeAudioDirectionSink && strategy != required_snk_strategy) { LOG_INFO(" Sink strategy mismatch group!=cfg.entry (%d!=%d)", LOG_DEBUG(" Sink strategy mismatch group!=cfg.entry (%d!=%d)", static_cast<int>(required_snk_strategy), static_cast<int>(strategy)); return false; Loading Loading @@ -1923,14 +1923,15 @@ LeAudioDeviceGroup::FindFirstSupportedConfiguration( /* Filter out device set for all scenarios */ if (!set_configurations::check_if_may_cover_scenario(confs, NumOfConnected())) { LOG_ERROR(", group is unable to cover scenario"); LOG_DEBUG(", group is unable to cover scenario"); return nullptr; } /* Filter out device set for each end every scenario */ auto required_snk_strategy = GetGroupStrategy(); for (const auto& conf : *confs) { if (IsConfigurationSupported(conf, context_type)) { if (IsConfigurationSupported(conf, context_type, required_snk_strategy)) { LOG_DEBUG("found: %s", conf->name.c_str()); return conf; } Loading
system/bta/le_audio/devices.h +2 −1 Original line number Diff line number Diff line Loading @@ -390,7 +390,8 @@ class LeAudioDeviceGroup { const std::vector<uint8_t>& ccid_list); bool IsConfigurationSupported( const set_configurations::AudioSetConfiguration* audio_set_configuration, types::LeAudioContextType context_type); types::LeAudioContextType context_type, types::LeAudioConfigurationStrategy required_snk_strategy); uint32_t GetTransportLatencyUs(uint8_t direction); /* Current configuration and metadata context types */ Loading
system/bta/le_audio/le_audio_types.cc +20 −29 Original line number Diff line number Diff line Loading @@ -649,51 +649,42 @@ std::ostream& operator<<(std::ostream& os, << ", AudioChanLoc=" << loghex(*config.audio_channel_allocation) << ")"; return os; } std::ostream& operator<<(std::ostream& os, const LeAudioContextType& context) { std::string contextTypeToStr(const LeAudioContextType& context) { switch (context) { case LeAudioContextType::UNINITIALIZED: os << "UNINITIALIZED"; break; return "UNINITIALIZED"; case LeAudioContextType::UNSPECIFIED: os << "UNSPECIFIED"; break; return "UNSPECIFIED"; case LeAudioContextType::CONVERSATIONAL: os << "CONVERSATIONAL"; break; return "CONVERSATIONAL"; case LeAudioContextType::MEDIA: os << "MEDIA"; break; return "MEDIA"; case LeAudioContextType::GAME: os << "GAME"; break; return "GAME"; case LeAudioContextType::INSTRUCTIONAL: os << "INSTRUCTIONAL"; break; return "INSTRUCTIONAL"; case LeAudioContextType::VOICEASSISTANTS: os << "VOICEASSISTANTS"; break; return "VOICEASSISTANTS"; case LeAudioContextType::LIVE: os << "LIVE"; break; return "LIVE"; case LeAudioContextType::SOUNDEFFECTS: os << "SOUNDEFFECTS"; break; return "SOUNDEFFECTS"; case LeAudioContextType::NOTIFICATIONS: os << "NOTIFICATIONS"; break; return "NOTIFICATIONS"; case LeAudioContextType::RINGTONE: os << "RINGTONE"; break; return "RINGTONE"; case LeAudioContextType::ALERTS: os << "ALERTS"; break; return "ALERTS"; case LeAudioContextType::EMERGENCYALARM: os << "EMERGENCYALARM"; break; return "EMERGENCYALARM"; default: os << "UNKNOWN"; break; return "UNKNOWN"; } } std::ostream& operator<<(std::ostream& os, const LeAudioContextType& context) { os << contextTypeToStr(context); return os; } Loading
system/bta/le_audio/le_audio_types.h +1 −0 Original line number Diff line number Diff line Loading @@ -686,6 +686,7 @@ using AudioLocations = std::bitset<32>; std::ostream& operator<<(std::ostream& os, const AseState& state); std::ostream& operator<<(std::ostream& os, const CigState& state); std::ostream& operator<<(std::ostream& os, const LeAudioLc3Config& config); std::string contextTypeToStr(const LeAudioContextType& context); std::ostream& operator<<(std::ostream& os, const LeAudioContextType& context); std::ostream& operator<<(std::ostream& os, const AudioStreamDataPathState& state); Loading