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

Commit 3f82d408 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

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



Change-Id: Ia71b8eb7856f8dbe3dbb275c9ec2026051fe991c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 9e932e5c 158f9e4b
Loading
Loading
Loading
Loading
+9 −39
Original line number Diff line number Diff line
@@ -2939,44 +2939,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;
@@ -2988,6 +2957,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;
    }
@@ -3046,9 +3017,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);