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

Commit b79228b0 authored by Tom Huang's avatar Tom Huang Committed by Android (Google) Code Review
Browse files

Merge "Add OPUS support property check." into tm-qpr-dev

parents a2ced21b 780a0eee
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -559,6 +559,9 @@ bool A2dpCodecs::init() {
  LOG_INFO("%s", __func__);
  std::lock_guard<std::recursive_mutex> lock(codec_mutex_);

  bool opus_enabled =
      osi_property_get_bool("persist.bluetooth.opus.enabled", false);

  for (int i = BTAV_A2DP_CODEC_INDEX_MIN; i < BTAV_A2DP_CODEC_INDEX_MAX; i++) {
    btav_a2dp_codec_index_t codec_index =
        static_cast<btav_a2dp_codec_index_t>(i);
@@ -571,6 +574,13 @@ bool A2dpCodecs::init() {
      codec_priority = cp_iter->second;
    }

    // If OPUS is not supported it is disabled
    if (codec_index == BTAV_A2DP_CODEC_INDEX_SOURCE_OPUS && !opus_enabled) {
      codec_priority = BTAV_A2DP_CODEC_PRIORITY_DISABLED;
      LOG_INFO("%s: OPUS codec disabled, updated priority to %d", __func__,
               codec_priority);
    }

    A2dpCodecConfig* codec_config =
        A2dpCodecConfig::createCodec(codec_index, codec_priority);
    if (codec_config == nullptr) continue;