Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 570fc219 authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Gerrit Code Review
Browse files

Merge "LE Audio: logging improvements around context type avaliability"

parents 39b9292a ac98f049
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -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()),
@@ -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) {
@@ -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() &
@@ -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;
@@ -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",
@@ -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.
@@ -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;
@@ -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;
    }
+2 −1
Original line number Diff line number Diff line
@@ -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 */
+20 −29
Original line number Diff line number Diff line
@@ -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;
}

+1 −0
Original line number Diff line number Diff line
@@ -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);