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

Commit ed6f251f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Refine the map between audio attribute and LE audio context type" am:...

Merge "Refine the map between audio attribute and LE audio context type" am: fe37b4bc am: 158f9e4b am: 3f82d408 am: 634f08cb am: c0ae04f1

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2063244



Change-Id: I869cc5693933d62728647e5976a32082cb06dd0c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 92828523 c0ae04f1
Loading
Loading
Loading
Loading
+9 −39
Original line number Diff line number Diff line
@@ -2945,44 +2945,13 @@ class LeAudioClientImpl : public LeAudioClient {
  LeAudioContextType AudioContentToLeAudioContext(
      LeAudioContextType current_context_type,
      audio_content_type_t content_type, audio_usage_t usage) {
    /* Let's stay on the Conversational context type in case it is already
     * configured to conversational.
     */
    if (current_context_type == LeAudioContextType::CONVERSATIONAL) {
      switch (content_type) {
        case AUDIO_CONTENT_TYPE_SONIFICATION:
        case AUDIO_CONTENT_TYPE_SPEECH:
          return LeAudioContextType::CONVERSATIONAL;
        default:
          break;
      }

    /* Check audio attribute usage of stream */
    switch (usage) {
        case AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE:
        case AUDIO_USAGE_NOTIFICATION:
        case AUDIO_USAGE_ALARM:
        case AUDIO_USAGE_EMERGENCY:
        case AUDIO_USAGE_VOICE_COMMUNICATION:
          return LeAudioContextType::CONVERSATIONAL;
        default:
          break;
      }
    }

    switch (content_type) {
      case AUDIO_CONTENT_TYPE_SPEECH:
        return LeAudioContextType::CONVERSATIONAL;
      case AUDIO_CONTENT_TYPE_MUSIC:
      case AUDIO_CONTENT_TYPE_MOVIE:
      case AUDIO_CONTENT_TYPE_SONIFICATION:
      case AUDIO_USAGE_MEDIA:
        return LeAudioContextType::MEDIA;
      default:
        break;
    }

    /* Context is not clear, consider also usage of stream */
    switch (usage) {
      case AUDIO_USAGE_VOICE_COMMUNICATION:
      case AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING:
      case AUDIO_USAGE_CALL_ASSISTANT:
        return LeAudioContextType::CONVERSATIONAL;
      case AUDIO_USAGE_GAME:
        return LeAudioContextType::GAME;
@@ -2994,6 +2963,8 @@ class LeAudioClientImpl : public LeAudioClient {
        return LeAudioContextType::ALERTS;
      case AUDIO_USAGE_EMERGENCY:
        return LeAudioContextType::EMERGENCYALARM;
      case AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE:
        return LeAudioContextType::INSTRUCTIONAL;
      default:
        break;
    }
@@ -3052,9 +3023,8 @@ class LeAudioClientImpl : public LeAudioClient {
        continue;
      }

      DLOG(INFO) << __func__ << ": usage=" << tracks->usage
                 << ", content_type=" << tracks->content_type
                 << ", gain=" << tracks->gain;
      LOG_INFO("%s: usage=%d, content_type=%d, gain=%f", __func__,
               tracks->usage, tracks->content_type, tracks->gain);

      auto new_context = AudioContentToLeAudioContext(
          current_context_type_, tracks->content_type, tracks->usage);