Fix the bogus configs default-constructed as a2dp configs
When the xml file contains the "invalid" entry in the scenario record, which do not refer to any valid config in the 'configurationList` section, the invalid, default constructed codec configuration (a2dp codec) was created. Bug: 319090769 Test: atest VtsHalBluetoothAudioTargetTest Change-Id: I19b7d1af81e5f2be3fb7261fba8781b3dc47fa12
This commit is contained in:
parent
0259aafb71
commit
06781c028a
2 changed files with 15 additions and 8 deletions
|
@ -736,8 +736,7 @@ TEST_P(BluetoothAudioProviderFactoryAidl, getProviderInfo_leAudioSessionTypes) {
|
|||
ASSERT_NE(codec_info.id.getTag(), CodecId::a2dp);
|
||||
// The codec info must contain the information
|
||||
// for le audio transport.
|
||||
// ASSERT_EQ(codec_info.transport.getTag(),
|
||||
// CodecInfo::Transport::le_audio);
|
||||
ASSERT_EQ(codec_info.transport.getTag(), CodecInfo::Transport::leAudio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,8 +77,6 @@ BluetoothLeAudioCodecsProvider::GetLeAudioCodecInfo(
|
|||
for (auto& p : configuration_map_) {
|
||||
// Initialize new CodecInfo for the config
|
||||
auto config_name = p.first;
|
||||
if (config_codec_info_map_.count(config_name) == 0)
|
||||
config_codec_info_map_[config_name] = CodecInfo();
|
||||
|
||||
// Getting informations from codecConfig and strategyConfig
|
||||
const auto codec_config_name = p.second.getCodecConfiguration();
|
||||
|
@ -92,6 +90,9 @@ BluetoothLeAudioCodecsProvider::GetLeAudioCodecInfo(
|
|||
if (strategy_configuration_map_iter == strategy_configuration_map_.end())
|
||||
continue;
|
||||
|
||||
if (config_codec_info_map_.count(config_name) == 0)
|
||||
config_codec_info_map_[config_name] = CodecInfo();
|
||||
|
||||
const auto& codec_config = codec_configuration_map_iter->second;
|
||||
const auto codec = codec_config.getCodec();
|
||||
const auto& strategy_config = strategy_configuration_map_iter->second;
|
||||
|
@ -137,12 +138,19 @@ BluetoothLeAudioCodecsProvider::GetLeAudioCodecInfo(
|
|||
}
|
||||
}
|
||||
|
||||
// Goes through every scenario, deduplicate configuration
|
||||
// Goes through every scenario, deduplicate configuration, skip the invalid
|
||||
// config references (e.g. the "invalid" entries in the xml file).
|
||||
std::set<std::string> encoding_config, decoding_config, broadcast_config;
|
||||
for (auto& s : supported_scenarios_) {
|
||||
if (s.hasEncode()) encoding_config.insert(s.getEncode());
|
||||
if (s.hasDecode()) decoding_config.insert(s.getDecode());
|
||||
if (s.hasBroadcast()) broadcast_config.insert(s.getBroadcast());
|
||||
if (s.hasEncode() && config_codec_info_map_.count(s.getEncode())) {
|
||||
encoding_config.insert(s.getEncode());
|
||||
}
|
||||
if (s.hasDecode() && config_codec_info_map_.count(s.getDecode())) {
|
||||
decoding_config.insert(s.getDecode());
|
||||
}
|
||||
if (s.hasBroadcast() && config_codec_info_map_.count(s.getBroadcast())) {
|
||||
broadcast_config.insert(s.getBroadcast());
|
||||
}
|
||||
}
|
||||
|
||||
// Split by session types and add results
|
||||
|
|
Loading…
Reference in a new issue